Closed
Description
Smallish reproduction case:
@Component(selector: 'example')
@View(
directives: const [NgFor, CSSClass],
template: '''
<button (click)="increment()">Increment</button>
<div *ng-for="var item of items" [class]="item">
<div [class]="item">
{{item}}
</div>
</div>
''')
class ExampleComponent {
var next = 0;
var items = ['0'];
void increment() {
items = ['${++next}'];
}
}
What happens in this example is that if you click the "Increment" button 10 times, the resulting DOM is:
<div *ng-for="var item of items" [class]="item" class="ng-binding 0 1 2 3 4 5 6 7 8 9 10">
<div [class]="item" class="ng-binding 0 1 2 3 4 5 6 7 8 9 10">
10
</div>
</div>
Instead, I'd expect each div's class to contain only 10, instead of all the numbers up to 10.