I am working with the code snippet below:
get items():Observable<MenuItem[]>{
let items: MenuItem[] = [
{
label: "incidents_dialog_tab_actions_measures_defined"
},
{
label: "incidents_dialog_tab_actions_measures_with_supplier_agreed"
},
{
label: "incidents_dialog_tab_actions_measures_are_implemented"
},
{
label: "incidents_dialog_tab_actions_measures_are_effective"
}
];
return Observable.from(items).mergeMap( obj => this.commonModel.translate(obj.label)).bufferCount(items.length);
}
The method
this.commonModel.translate(obj.label)
in the code returns an observable.
In my template, I want to use it in the following way: [model]="items | async"
. Here, 'items' should be an observable of an array that contains translations in the format { label: translation}
. How can I achieve this?