Exercise: Custom Pipes
Let’s implement a custom pipe.
We'll cover the following
Objectives
We want to do more work on the user profile card so that meets the following requirements:
-
It should render the user name and last name using a pipe, so that it emulates the following syntax:
<p> {{ user | fullname }} </p>
-
It should render the type of account using a pipe that takes only the account type as input arguments, like this:
<p> {{ user.account | accountType }} </p>
-
The premium account should read “Premium account.”
-
The standard account should read “Standard account.”
-
The trial account should read “Account on trial.”
-
Task
Let’s write the code below:
Get hands-on with 1400+ tech skills courses.