Custom validator validating multiple controls
While we often just see a text box that we can type into, it does way more work for us.Every native form element is accessible, some inputs have built-in validation and some even provide an improved user experience on different platforms (e.g. So whenever we think of creating a custom form control we should ask ourselves: We will discuss different scenarios through out this article to demonstrate how these things can be implemented.He specialises in breaking down complex topics and understands the critical mission of learning new technology fast, comprehensively and the right way.There are many things that Angular helps us out with when creating forms.So after all, it happens that our component implements the interface, but we still need to make Angular pick it up as such.
Before we can learn “how to do custom validation”, we must dive into the workings of the APIs first to see what’s happening and actually have some idea what’s going on, so let’s do that real quick.
In fact, if we try to bind any kind of form model to our custom control, we’ll get an error that there’s a missing ?
Well, remember the things we talked about earlier that are needed to implement a custom form control?
Almero Steyn, one of our training students, who later on contributed to the official documentation as part of the Docs Authoring Team for Angular, has also written a very nice introduction to creating custom controls.
His article inspired us and we would like to take it a step further and explore how to create custom form controls that integrate nicely with Angular’s form APIs. code View Demos Before we get started and build our own custom form control, we want to make sure that we have an idea of the things come into play when creating custom form controls.First of all, it’s important to realise that we shouldn’t just create custom form controls right away, if there’s a native element (like ) that perfectly takes care of the job.