7. Types : -
Components Directives
Directives with a
template.
E.g : Normal
Components made by
user with angular CLi
“ng g c CompName”
Structural directives
Change the DOM
layout by adding and
removing DOM
elements.
E.g: ngFor ,ngIf
Attribute directives
Change the
appearance or
behavior of an
element, component,
or another directive.
E.g: ngModule
7
11. 11
NgClass
NgStyle
NgIf
NgSwitch
NgFor
Built-In Angular Directives : -
● The ng-if directive removes the HTML element if
the expression evaluates to false.
● If the if statement evaluates to true, a copy of
the Element is added in the DOM.
<div *ngIf = “2>1”><h1>yes<h1></div>