October 2017
Intermediate to advanced
280 pages
6h 50m
English
Let's develop a pipe that transforms the value of the popular property and uses it in place of NgSwitch and NgSwitchCase. The pipe will accept three arguments: a value that should be transformed, a string that should be displayed when the value is truthy, and another string that should be displayed in case of a falsy value.
With the use of an Angular custom pipe, we will be able to simplify the template to the following:
<td>{{dev.popular | boolean: 'Yes': 'No'}}</td>
We can even use emojis, as follows:
<td>{{dev.popular | boolean: '
': ''}}</td>
We apply pipe to the value the same way we would do in AngularJS. The ...
Read now
Unlock full access