I18nSelectPipe
Experimental Pipe
Что делает
Общий селектор, отображающий строку, соответствующую текущему значению.
Как использовать
expression | i18nSelect:mapping
NgModule
CommonModuleОписание
Где mapping — это объект, указывающий текст, который должен отображаться для различных значений предоставленного expression. Если ни один из ключей сопоставления не совпадает со значением expression, то содержимое ключа other возвращается при наличии, в противном случае возвращается пустая строка.
Пример
@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.'};
}
экспортировано из @angular/common/index определено в @angular/common/src/pipes/i18n_select_pipe.ts
© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v2.angular.io/docs/ts/latest/api/common/index/I18nSelectPipe-pipe.html