fix(common): properly update collection reference in NgForOf (#24684)

closes #24155

PR Close #24684
This commit is contained in:
Trotyl
2018-06-27 13:05:56 +08:00
committed by Misko Hevery
parent 0f1de35604
commit 9a98de941d
2 changed files with 5 additions and 1 deletions

View File

@ -183,9 +183,12 @@ let thisArg: any;
it('should allow of saving the collection', async(() => {
const template =
'<ul><li *ngFor="let item of [1,2,3] as items; index as i">{{i}}/{{items.length}} - {{item}};</li></ul>';
'<ul><li *ngFor="let item of items as collection; index as i">{{i}}/{{collection.length}} - {{item}};</li></ul>';
fixture = createTestComponent(template);
detectChangesAndExpectText('0/2 - 1;1/2 - 2;');
getComponent().items = [1, 2, 3];
detectChangesAndExpectText('0/3 - 1;1/3 - 2;2/3 - 3;');
}));