Problem
After the version of Angular 2.2. *, I noticed a problem in some components of my application that after updating the data, the data was incorrect in the view (he presented a list with the right size, but only with data of only the first element).
Demonstration
I created this Plunker with a simple example of a problem.
This type of use causes a problem:
<list-component [data]="list">
<template pTemplate let-item>
<b *ngIf="item % 2 == 0">{{item}}</b>
<del *ngIf="item % 2 != 0">{{item}}</del>
</template>
</list-component>
Instructions for the problem:
- Open an example in Plunker;
- Obverse of the second block (Template with
*ngIf:) - Click the "Refresh" button;
- And look at the second block (Template with
*ngIf:) again;
Question
What could be causing this problem and how to solve it?