ngClass Directive is an Angular 2 Attribute Directive, which allows us to add or remove CSS classes to an HTML element. Using ngClass you can create dynamic styles in HTML pages.
The ngIf is an Angular 2 Structural Directive, which allows us to Add/Remove DOM Element. It is similar to ng-if directive of AngularJs. In this Tutorial let us look at the syntax of ngIf. We will show you how to use ngIf using an example code.
In this Introduction to Angular 2 Directive, we are going to look at the Angular Directives. We will look at three types of directives that angular supports like Component, Structural and Attribute Directives. We also look the few of the most commonly used Angular2 directives.