PipeTransform
interface
An interface that is implemented by pipes in order to perform a transformation. Angular invokes the transform
method with the value of a binding as the first argument, and any parameters as the second argument in list form.
interface PipeTransform {
transform(value: any, ...args: any[]): any
}
Class implementations
AsyncPipe
DatePipe
I18nPluralPipe
I18nSelectPipe
JsonPipe
LowerCasePipe
CurrencyPipe
DecimalPipe
PercentPipe
SlicePipe
UpperCasePipe
TitleCasePipe
KeyValuePipe
Methods
transform() | ||||||
---|---|---|---|---|---|---|
transform(value: any, ...args: any[]): anyParameters
Returns
|
Usage notes
In the following example, RepeatPipe
repeats a given value a given number of times.
import {Pipe, PipeTransform} from '@angular/core';
@Pipe({name: 'repeat'})
export class RepeatPipe implements PipeTransform {
transform(value: any, times: number) {
return value.repeat(times);
}
}
Invoking Template:'ok'
in a template produces okokok
.
© 2010–2020 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v10.angular.io/api/core/PipeTransform