The pipe operator

By looking at the highlighted lines of the preceding source code, we can see how we used the pipe operator (|), which is another useful tool coming from the Angular Template Syntax.

To quickly summarize what it does, we can say the following: the pipe operator allows the use of some transformation functions that can be used to perform various tasks such as format strings, join array elements into a string, uppercase/lowercase a text, and sort a list. Here are the pipes that come built-in with Angular: DatePipe, UpperCasePipe, LowerCasePipe, CurrencyPipe, PercentPipe, and JsonPipe; these are all available for use in any template. Needless to say, we used the latter in the preceding script to transform the form.value and form.status objects into readable JSON strings.

It's worth noting that we can also chain multiple pipes and define custom pipes; however, we don't need to do that for the time being and talking about such a topic will bring us far from the scope of this chapter. If you want to know more about pipes, we strongly suggest you to read the official Angular documentation at https://angular.io/guide/pipes.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.34.25