I'm using keys pipe in *ngfor loop. Data are fed in JSON.
@Pipe({
name: 'keys'
})
export class KeysPipe implements PipeTransform {
transform(value, args: string[]): any {
if (!value) {
return value;
}
let keys = [];
for (let key in value) {
keys.push({key: key, value: value[key]});
}
return keys;
}
}
--
<div *ngFor="let item of jsonObject | keys">
<p>{{ item.value.code }}</p>
</div>
The problem is when I delete on of the element in JSON, ngFor is not updated.
I have tried two option already:
- calling this.applicationRef.tick(); after element delete, no change
- impure pipe "pure: false". This caused enormous memory usage in chrome in hundreds of MBs and I had to kill the process.
If there any other way?
Thanks!