NgValidationError
constant
The base class for all built-in, non-custom errors. This class can be used to check if an error is one of the standard kinds, allowing you to switch on the kind to further narrow the type.
Usage Notes
const f = form(...);
for (const e of form().errors()) {
if (e instanceof NgValidationError) {
switch(e.kind) {
case 'required':
console.log('This is required!');
break;
case 'min':
console.log(`Must be at least ${e.min}`);
break;
...
}
}
}
Jump to details