I18nSelectPipe

Experimental Pipe

What it does

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

How to use

expression | i18nSelect:mapping

NgModule

CommonModule

Description

Where:

  • mapping: is an object that indicates the text that should be displayed for different values of the provided expression.

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

exported from @angular/common/index defined in @angular/common/src/pipes/i18n_select_pipe.ts

doc_Angular
2016-10-06 09:46:37
Comments
Leave a Comment

Please login to continue.