core/forms/extract-array-validation-errors.pipe.ts
This pipe should be used in pair with validateArrayElements function - it allows to distribute errors for each position in array, from the object prepared by validateArrayElements.
Example :errors = {
"INNER_ARRAY_ERROR_minlength": {
isArrayError: true,
originalKey: "minlength",
entries: [
{
index: 0,
errorData: {
requiredLength: 5,
actualLength: 4
}
},
{
index: 2,
errorData: {
requiredLength: 5,
actualLength: 3
}
},
]
},
"minlength": {
requiredLength: 5,
actualLength: 3
}
}
<small *ngFor="let error of errors | extractArrayValidationErrors:index | keyvalue">
{{ error.key | humanizeValidationMessage | translate: error.value }}
</small>
Above code renders only these error messages that are generated by Array entries.
Name | extractArrayValidationErrors |
transform | |||||||||
transform(validationErrors: ArrayValidationErrors | ValidationErrors | null, index: number)
|
|||||||||
Parameters :
Returns :
ValidationErrors | null
|