I have a component that accepts as an input array objects that should be filtered and displayed in the template.
@Input() inputAddons: Array<InputAddon>;
addOns: Observable<InputAddon>;
lblLeftAddons: Observable<InputAddon>;
The definition in the class is higher.
ngOnInit(): void {
this.addOns = Observable.from(this.inputAddons);
this.lblLeftAddons = this.addOns.filter(function (x){
return x.pos == 'left' && x.type == 'label'}
);
this.lblLeftAddons.subscribe(x => console.log(x));
}
this is the code in which i filter the array
in the template i have this code
*ngFor="#addon of lblLeftAddons | async"
but that will not work. I get an exception
Cannot find a differ supporting object '[object Object]' in [lblLeftAddons | async in InputText@14:10]
Any ideas what I'm doing wrong?
source
share