initial commit
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
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`;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user