Tuesday 1 May 2018

Directives in Angular 2.

In this article, We will discuss about What is Directives in angular 2.

Angular is providing directives to extend html functionality.

Angular directives are similar to html element attributes.

Directives are divided into 3 types,
i/ Component Directive
ii/ Behavioural Directive
iii/ Structural Directive

i/ Component Directive:-
------------------------------
This directive based on Component class [template] using selector is called "Component Directive".

This allows using Component [template] as an element[tag] with in webpage.

ii/ Behavioural Directive:-
-------------------------------
This directives will change appearance or behaviour of html element.

Example:-[ngStyle],[ngClass],[ngSwitch],[(ngModel)]

iii/ Structural Directive:-
------------------------------
This Directives will add/remove html tag[element] dynamically into browser dom.

This Directive will start with * symbol.

Example:- *ngIf,*ngFor,*ngSwitchCase,*ngSwitchDefault.

0 comments:

Post a Comment