Validating custom control

Angular checks if the control/group is in error if a key exists in its errors dictionary and if the value of that key is evaluates to true.

When building a validator, I like to check if the required validator already exists and just return that the validator is valid.

In most circumstances, you'd add the control with code like this: The On Server Validate="Server Validate" defines a sub or function within your codebehind, which is called to validate whether control your checking is valid.

It's important to note that it can only work with the one control - it can't really reach out and check the status of other controls.

As you know, you can create a form Group through the method.The last method we won’t really need as it handles touch events, but to satisfy the interface it can just be implemented with an empty block.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.As an example we will create a custom textarea component, where the validation checks that the user input is a valid JSON string.The validated result will be displayed outside of the form via binding, which will only update when the user input is valid.

Leave a Reply