Pipe Parameters
We'll learn how to use pipe parameters in this lesson.
We'll cover the following...
We’ll look at another pipe defined by Angular called the DatePipe
. The DatePipe
will help you format dates into various formats. It’s a versatile pipe because we have the freedom to use different formats.
The DatePipe
requires the date to be a Date()
object, time in milliseconds from 1970, or an ISO string. We must make sure the value is in the required format before we use the DatePipe
. Otherwise, it won’t work.
In the app.component.ts
file, we’ll create a property called todaysDate
. Its value will be a new instance of the Date
object.