Reputation: 3801
What is the advantage of using an Angular pipe when a comparable native JavaScript function exists? For example:
<input type="text" [value]="foo | uppercase">
vs.
<input type="text" [value]="foo.toUpperCase()">
Upvotes: 0
Views: 169
Reputation: 936
pipe
decorator @Pipe
has pure
option which is if false
will listen to your changes of the variable passed in and rerun
the pipe
With pure: false
the pipe
is evaluated each time Angular runs change detection.
also with toUpperCase()
supose view will not evaluate your ts
variable again
Upvotes: 1