// Utilisation dans un template
<p>Creation date : {{ create_at | date }}</p>
// Paramètre de pipe
<p>Creation date : {{ create_at | date:'MM/DD/AAAA' }}</p>
// pipes chainés
<p>Creation date : {{ create_at | date | uppercase }}</p>
// DatePipe
<p>Creation date : {{ create_at | date }}</p>
// UpperCasePipe
<p>Creation date : {{ username | uppercase }}</p>
// LowerCasePipe
<p>Creation date : {{ username | lowercase }}</p>
// CurrencyPipe
<p>Creation date : {{ price | currency }}</p>
// PercentPipe
<p>Creation date : {{ price | percent }}</p>
// JsonPipe
<p>Creation date : {{myObject | json }}</p>
import { Pipe, PipeTransform } from '@angular/core'
export class ReversePipe implements PipeTransform {
transform(value:string, args:string[]) : any {
return value.reverse()
}
}
// Component
asyncAttribute<string> = new Promise((resolve, reject) => {
setTimeout(() => resolve('Promise resolved'), 500);
})
// Template
<p>Async result: {{ asyncAttribute | async }}