Attribute Directives
Attribute Directives extend the behavior or the look and feel of a given element. Attribute Directives are very similar to HTML attributes defined along with the element.
Attribute Directives can be of two types:
- Built-in Attribute Directive
- Custom or user-defined Attributes Directive
Let's now look at them in detail in the following sections.
Built-in Attribute Directives
As mentioned before, attributes are properties of the elements in the page. Some of the examples of the attributes for HTML elements are class, style, and so on.
Similarly Angular provides several built-in Attribute Directives. The directives include ngModel
, ngClass
, ngStyle
, and so on.
Let's learn about each of these Attribute Directives by creating few examples that are shown as follows for your reference:
ngModel
: UsingngModel
, we can implement a Two-way Data Binding. For learning more about Data Binding and Template Syntax, please refer to Chapter 8, Template and Data Binding Syntax.
The ngModel
directive...