I'm trying to use I18nSelectPipe
. I have the following code
:
this.criteria = [];
this.criteria.push({
id: 1,
name: 'ab'
});
this.criteria.push({
id: 2,
name: 'cd'
});
this.criteria.push({
id: 3,
name: 'ef'
});
this.criteriaChoice = {};
this.criteriaChoice['1'] = 'One';
this.criteriaChoice['2'] = 'Two';
this.criteriaChoice['3'] = 'Three';
In HTML
:
<div *ngFor="let criterium of criteria">
<strong>{{criterium.id | i18nSelect: criteriaChoice}}</strong>
</div>
As you may have noticed, I'm trying simply translate a "key" using that pipe, but it always returns me the following error:
ORIGINAL EXCEPTION: Invalid argument '[object Object]' for pipe 'I18nSelectPipe'
If I try something simple as below, it works:
<strong>{{'1' | i18nSelect: criteriaChoice}}</strong>
How can I solve this?
By the way, it's a sample code, the code isn't hardcoded this way.