On this page
I18nPluralPipe
pipe
npm Package | @angular/common |
---|---|
Module | import { I18nPluralPipe } from '@angular/common'; |
Source | common/src/pipes/i18n_plural_pipe.ts |
NgModule | CommonModule |
How To Use
expression | i18nPlural:mapping[:locale]
Description
Where:
expression
is a number.mapping
is an object that mimics the ICU format, see http://userguide.icu-project.org/formatparse/messageslocale
is astring
defining the locale to use (uses the currentLOCALE_ID
by default)Example
@Component({
selector: 'i18n-plural-pipe',
template: `<div>{{ messages.length | i18nPlural: messageMapping }}</div>`
})
export class I18nPluralPipeComponent {
messages: any[] = ['Message 1'];
messageMapping:
{[k: string]: string} = {'=0': 'No messages.', '=1': 'One message.', 'other': '# messages.'};
}
© 2010–2018 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v5.angular.io/api/common/I18nPluralPipe