Angular 7

Angular 7 Directives

Angular Directives are inbuilt or custom (user defined) functions. They are executed when they are found on the DOM by the Angular Compiler.

Three types of Directives :

  • Component Directives

  • Structural Directives

  • Attribute Directives -> ngClass ; ngStyle;

  • Custom Directives

Directives are declared as @directive

  • Structural Directives

Structural directives help you to Add or Remove HTML elements.

Three most used structural directives are :

  1. ngIf

  2. ngSwitch

  3. ngFor


_______

Data binding

one way data binding -> Angular Interpolation / String Interpolation, Property Binding, and Event Binding are the example of one-way databinding.


two way data binding -> Angular provides four types of data binding and they are different on the way of data flowing.

so there are 4 types of data binding :-