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 wrong in the view (it presented the list with the right size, but only with the data only of the first item) .
Demonstration
I created this Plunker with a simple example of the problem.
This type of use causes the 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 to occur:
- Open the example in Plunker;
- Obverse the second block (Template with
*ngIf
:) - Click the "Refresh" button;
- And look at the second block (Template with
*ngIf
:) again;
Question
What can be causing this problem and how to solve it?