Even though they might look like standard HTML input elements, when we work with AngularJS we can talk about input directives because in fact AngularJS expands the standard HTML input elements by adding new features and taking care of the underlying model updates to reflect the changes in the input items.
In this example we see different types of input elements:
- standard text input field
- e-mail field
- URL field
- password field
- numeric field
- standard multi-line text area
The standard text field, the password field and the text area behaviors will look the same as the corresponding standard HTML elements, but with the e-mail, URL and numeric fields you can notice immediately a difference. Try to type something invalid (not correctly formatted for the specified type) in the latter fields and you'll see that the model variables bound to them will be null whenever their values are invalid. This is a special check made by AngularJS to make sure that the model always contains only valid values (e.g. if you type a string that is not a number in the numeric field, then the model variable bound to it will be null).