i18nPlural pipe
This is the documentation for Angular 6.
You can switch to the latest version Angular 10.
You can switch to the latest version Angular 10.
Maps a value to a string that pluralizes the value according to locale rules.
See CLDR — Plural Rules.
Source
<input [(ngModel)]="value">
{{ value | i18nPlural: mapping }}
export class AppComponent {
value = 1;
mapping: {[k: string]: string} = {
'=0': 'No messages.',
'=1': 'One message.',
'other': '# messages.',
};
}
Result