Now that you have some idea about data annotation attributes, let's develop a simple ASP.
This will add these validation CSS classes used by
If you enter a longer value, you will see this generic validation message: So it is a good idea to add a comment as well to let the user know what this range If the limit is important for data integrity, you should also add server side validatation, using a backend model.
This post will go over how to create a custom input component which supports validation and is compatible with both ng Model forms and Reactive Forms.
As an example we will create a custom textarea component, where the validation checks that the user input is a valid JSON string.
This is how we will implement the interface in our component: The interface is just a ‘contractual obligation’ to provide methods that can be called somewhere else.