Forms are what we use every day and if there's a form, we often have to validate the input and show the validation results to the user.
Problems:
Opportunity:
Feature request:
Example:
// global setup
validationService.configure({
showIf: 'touchedOrDirty',
messages: {
required: "This field is required',
customKey: 'This field needs ... ',
customKey2: errorMessageForCustomKey2Fn
});
// callback to generated error message for customKey2
function errorMessageForCustomKey2Fn(control: FormControl) => return `can include 'but is ... ' from form control`;
// HTML in component template
<input formControlName="myinput" ... />
<validation-errors forControlName="myinput"> // < should handle all globally registered errors without additional code.
<error key="keyOfValidatorOnlyUsedHere">Sorry, but you have to</error>
</validation-errors>
I think such a feature could massively reduce the work to setup forms.