diff --git a/packages/common/src/directives/ng_for_of.ts b/packages/common/src/directives/ng_for_of.ts index a3ca619cbd..89cb9c1b2e 100644 --- a/packages/common/src/directives/ng_for_of.ts +++ b/packages/common/src/directives/ng_for_of.ts @@ -182,6 +182,7 @@ export class NgForOf implements DoCheck { 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 683333d0b6..0935650f7e 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;'); }));