src/app/@theme/pipes/plural.pipe.ts
name | ngxPlural |
transform | ||||||||||||||||
transform(input: number, label: string, pluralLabel: string)
|
||||||||||||||||
Defined in src/app/@theme/pipes/plural.pipe.ts:6
|
||||||||||||||||
Parameters :
Returns :
string
|
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({ name: 'ngxPlural' })
export class PluralPipe implements PipeTransform {
transform(input: number, label: string, pluralLabel: string = ''): string {
input = input || 0;
return input === 1
? `${input} ${label}`
: pluralLabel
? `${input} ${pluralLabel}`
: `${input} ${label}s`;
}
}