diff --git a/modules/angular2/src/change_detection/abstract_change_detector.ts b/modules/angular2/src/change_detection/abstract_change_detector.ts index fdcee50351..42f3ebaa26 100644 --- a/modules/angular2/src/change_detection/abstract_change_detector.ts +++ b/modules/angular2/src/change_detection/abstract_change_detector.ts @@ -46,7 +46,7 @@ export class AbstractChangeDetector extends ChangeDetector { this._detectChangesInLightDomChildren(throwOnChange); - this.callOnAllChangesDone(); + if (throwOnChange === false) this.callOnAllChangesDone(); this._detectChangesInShadowDomChildren(throwOnChange); diff --git a/modules/angular2/test/change_detection/change_detector_spec.js b/modules/angular2/test/change_detection/change_detector_spec.js index cddf1d435d..8978818cdd 100644 --- a/modules/angular2/test/change_detection/change_detector_spec.js +++ b/modules/angular2/test/change_detection/change_detector_spec.js @@ -339,6 +339,22 @@ export function main() { expect(directive1.onChangesDoneCalled).toBe(true); expect(directive2.onChangesDoneCalled).toBe(true); + + // reset directives + directive1.onChangesDoneCalled = false; + directive2.onChangesDoneCalled = false; + + // Verify that checking should not call them. + cd.checkNoChanges(); + + expect(directive1.onChangesDoneCalled).toBe(false); + expect(directive2.onChangesDoneCalled).toBe(false); + + // re-verify that changes are still detected + cd.detectChanges(); + + expect(directive1.onChangesDoneCalled).toBe(true); + expect(directive2.onChangesDoneCalled).toBe(true); });