Cookies concent notice

This site uses cookies from Google to deliver its services and to analyze traffic.
Learn more
Skip to main content
Angular has a new websiteHead to Angular.devHome
/

This is the archived documentation for Angular v17. Please visit angular.dev to see this page for the current version of Angular.

I18nPluralPipe

Maps a value to a string that pluralizes the value according to locale rules.

      
      {{ value_expression | i18nPlural : pluralMap [ : locale ] }}
    

Exported from

Input value

value number

the number to be formatted

Parameters

pluralMap object

an object that mimics the ICU format, see https://unicode-org.github.io/icu/userguide/format_parse/messages/.

locale string

a string defining the locale to use (uses the current LOCALE_ID by default).

Optional. Default is undefined.

Usage notes

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.',
  };
}