A directive is a custom HTML element that is used to extend the power of HTML. Angular 2 has the following directives that get called as part of the BrowserModule module.
ngIf −
The ngif element is used to add elements to the HTML code if it evaluates to true, else it will not add the elements to the HTML code.
Syntax
*ngIf = 'expression'
If the expression evaluates to true then the corresponding gets added, else the elements are not added.
ngFor −
The ngFor element is used to elements based on the condition of the For loop.
Syntax
*ngFor = 'let variable of variablelist'
The variable is a temporary variable to display the values in the variablelist.