In this tutorial, we will look at how to create Angular 2 Custom Pipes. We looked at Angular 2 Pipes in our last tutorial. The Angular 2 comes with few built-in pipes like Date pipe, Currency pipe, and Number pipe etc. But these pipes might not be sufficient to our needs. That is where you need to build a Custom pipes in Angular 2
Angular 2 Pipes are the new way to Transform Data. They are similar to Filters in AngularJS. In this Tutorial we are going to look at what is pipes are & how to use them. We will see how to pass arguments to the pipe and how to chain pipes. We are also going to look at the few of the angular 2 built in pipes like currency pipe, date pipe, number pipe, percent pipe, decimal pipe, slice pipe.
The ngStyle directive allows you to modify the style of an HTML element using the expression. In this tutorial, we will look how to use ngStyle with few examples. Using ngStyle you can dynamically change the style of your HTML element. You also can bind these properties to components properties.
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.