
上QQ阅读APP看书,第一时间看更新
Attribute directives
An attribute directive will be added like an attribute to existing HTML elements, and this can alter or extend the behavior of HTML elements. For example, an ngModel directive, if added to an input element, will extend it by updating its value property and also by responding to change events:
<input [(ngModel)]="author.name">
We can also write our own directives apart from using existing ones, such as ngSwitch, ngStyles, and ngClass.