Cookies concent notice

This site uses cookies from Google to deliver its services and to analyze traffic.
Learn more
Skip to main content
This site is no longer updated.Head 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.

I18nSelectPipe

Generic selector that displays the string that matches the current value.

See more...

      
      {{ value_expression | i18nSelect : mapping }}
    

Exported from

Input value

value string

a string to be internationalized.

Parameters

mapping object

an object that indicates the text that should be displayed for different values of the provided value.

Description

If none of the keys of the mapping match the value, then the content of the other key is returned when present, otherwise an empty string is returned.

Further information is available in the Usage Notes...

Usage notes

Example

      
      @Component({
  selector: 'i18n-select-pipe',
  template: `<div>{{ gender | i18nSelect: inviteMap }}</div>`,
})
export class I18nSelectPipeComponent {
  gender: string = 'male';
  inviteMap: any = {'male': 'Invite him.', 'female': 'Invite her.', 'other': 'Invite them.'};
}