pipe
Maps a value to a string that pluralizes the value according to locale rules.
{{ value_expression | i18nPlural : pluralMap [ : locale ] }}
value | number | the number to be formatted |
pluralMap | object | an object that mimics the ICU format, see http://userguide.icu-project.org/formatparse/messages. |
locale | string | a Optional. Default is |
@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–2021 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v12.angular.io/api/common/I18nPluralPipe