Difference between Angular Filters and Angular2 Pipes?
Asked Answered
R

1

6

Could somebody explain me conceptual difference between Angular Filters and Angular2 Pipes? They are built for the same purpose, no? Is there any difference under hood?

<div>{{user.created | dateFormat }}</div>

Even the syntax is quite the same.

Reportorial answered 20/10, 2016 at 7:32 Comment(8)
What are Angular filters?Cris
They're pipes. ;-)Intervocalic
Filters ARE pipes :-)Nattie
@GünterZöchbauer updated question with the urls to docsReportorial
I don't think asynchronous filters are supported (I may be wrong). That's one differenceIntervocalic
You are mixin AngularJs and Angular2 ! In Angular2 there are only Pipes..Odelia
no, I'm asking about difference between ng1 filters and ng2 pipesReportorial
Here is the answer #41844826Giliana
M
4

Pipe was formerly known as filters in AngularJS 1.x. In Angular 1, we had filter which helped format, sort or transform how data was displayed in our templates. Filters can be used with a binding expression or a directive. In Angular 2, we have a similar feature but renamed to Pipes. This rename was to better align of what the feature does. Coming from the Unix background we | pipe together commands. So in Angular we use the same | pipe character to format our data.

Angular 2 has many new concepts and some of the same concepts from Angular 1.x. Most of the filters from Angular 1.x are retained in Angular 2.0 pipes, in addition to the creation of newer pipes. Angular 1.x and Angular 2 have an equal number of filters to pipes, but there isn’t a direct crossover

Musclebound answered 30/6, 2019 at 21:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.