Expert Angular
上QQ阅读APP看书,第一时间看更新

Filters and pipes in templates

AngularJS filters are now called as pipes in Angular. The filters are used after the pipe character (|) in AngularJS and there is no syntactical change in Angular. However, Angular calls the filters as pipes.

AngularJS:

<h1>Book Details:</h1> 
<p>{{vm.bookName}}</p> 
<p>{{vm.releaseDate | date }}</p> 

Angular:

<h1>Book Details:</h1> 
<p>{{bookName}}</p> 
<p>{{releaseDate | date }}</p> 

Notice we have applied a date pipe or filter to releaseDate and there is no syntactical change between AngularJS and Angular.