From the course: Angular: Testing and Debugging
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Adding a custom Angular pipe - Angular Tutorial
From the course: Angular: Testing and Debugging
Adding a custom Angular pipe
- [Instructor] Pipes let you change how Angular displays data in your app. They're great for things like making text uppercase and turning decimals into percents. They're also great for quickly localizing numbers and date formats. You can even use pipes to work directly with promises and observables. Check out Angular's website for a full list of built-in pipes and how they work. Let's add a feature in our app that highlights the filter string found in each name. A custom Angular pipe is an excellent choice for this kind of feature. We'll use the ng generate command to generate a new file for our pipe. I'll go up to the terminal menu, click on new terminal and then I'll type ng generate pipe and hit Enter. Angular is going to ask us what we want to name the pipe. You can name your file whatever you'd like. I'm going to call mine highlight text and I'm going to put it in a new pipes folder in the app directory. I do that by typing pipes/highlight-text and hitting Enter. Check out my…
Contents
-
-
-
-
-
(Locked)
Adding a local storage service4m 38s
-
(Locked)
Fixing dependency injection errors3m 38s
-
(Locked)
Getting and setting data in local storage3m 18s
-
(Locked)
Adding a custom Angular pipe4m 51s
-
Using regular expressions to find content4m 13s
-
(Locked)
Using a pipe to change HTML content4m 17s
-
(Locked)
Common pipe errors1m 53s
-
(Locked)
Understanding Angular decorators2m 6s
-
(Locked)
Challenge: Filter the array of users by locationId30s
-
(Locked)
Solution: Filter the array of users by locationId1m 23s
-
(Locked)
-
-
-
-
-