Angular provides several built-in pipes in the platform. In this video, learn how to use some of them.
- [Instructor] An angular pipe is a template expression operator that does display value transformations. They are designed to be used in interpolation syntax, and template statements within component template markup. The general idea being that you use a pipe after your statement that you wish to transform, and the pipe will run on that statement value and return a final value that the template will display. Angular has built in pipes, The watched on property of a media item is being displayed Let's see how we can use the angular date pipe we can use the pipe template expression operator after the mediaItem.watchedOn statement If we switch over to the browser, we can see the date value is now formatted. So back the media-item.component.html file, the value to the left of the pipe is the value to be passed into the pipe for transformation. Pipes can also support parameters. Parameters are set to the right of the pipe name, separated by colons. The date supports a parameter of a string that represents date formatting, one of those being the term shortDate. Let's add a colon and then shortDate in single quotes. This is a statement in the interpolation curly braces, so we need to wrap string values with single quotes, and the date pipe is expecting a string parameter. Switching back to the browser, we can see the new formatted date value. you separate each by a colon. Let's go back to the code and add the slice pipe The slice pipe takes a start position and a length. then another colon and the number 10. we see the longer names have been truncated. Pipes can also be chained. to the mediaItem.name output. which returns the final value
- What is Angular?
- Working with components
- Binding events and properties
- Getting data to components
- Using directives and pipes
- Creating Angular forms
- Validating form data
- How Angular does dependency injection
- Making HTTP calls
- Styling components
Skill Level Intermediate
Angular: Building an Interfacewith Ray Villalobos2h 20m Intermediate
1. Architecture Overview
3. Directives and Pipes
5. Dependency Injection and Services
8. Styling Components
Next steps1m 20s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.