diff --git a/packages/common/src/directives/ng_for_of.ts b/packages/common/src/directives/ng_for_of.ts index 7bffebc700..322d837b2d 100644 --- a/packages/common/src/directives/ng_for_of.ts +++ b/packages/common/src/directives/ng_for_of.ts @@ -176,6 +176,7 @@ export class NgForOf implements DoCheck, OnChanges { const viewRef = >>this._viewContainer.get(i); viewRef.context.index = i; viewRef.context.count = ilen; + viewRef.context.ngForOf = this._ngForOf; } changes.forEachIdentityChange((record: any) => { diff --git a/packages/common/test/directives/ng_for_spec.ts b/packages/common/test/directives/ng_for_spec.ts index 541d1863cc..8c1e178f24 100644 --- a/packages/common/test/directives/ng_for_spec.ts +++ b/packages/common/test/directives/ng_for_spec.ts @@ -183,9 +183,12 @@ let thisArg: any; it('should allow of saving the collection', async(() => { const template = - ''; + ''; 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;'); }));