I18nSelectPipe

From Get docs
< @angular/commonAngular/docs/latest/api/common/i18nselectpipe /
Revision as of 02:35, 6 December 2021 by Notes (talk | contribs) (Page commit)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


I18nSelectPipe

pipe

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

See more...

Template:Value expression

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

© 2010–2021 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://angular.io/api/common/I18nSelectPipe