Skip to content

Commit

Permalink
feat(ChangeDetectorRef): make detectChanges() correct
Browse files Browse the repository at this point in the history
Closes #8599
  • Loading branch information
laco0416 authored and tbosch committed Jun 1, 2016
1 parent 2953ea1 commit 6028368
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions modules/@angular/core/src/linker/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,7 @@ export abstract class AppView<T> {

detectChanges(throwOnChange: boolean): void {
var s = _scope_check(this.clazz);
if (this.cdMode === ChangeDetectionStrategy.Detached ||
this.cdMode === ChangeDetectionStrategy.Checked ||
if (this.cdMode === ChangeDetectionStrategy.Checked ||
this.cdState === ChangeDetectorState.Errored)
return;
if (this.destroyed) {
Expand All @@ -304,13 +303,17 @@ export abstract class AppView<T> {

detectContentChildrenChanges(throwOnChange: boolean) {
for (var i = 0; i < this.contentChildren.length; ++i) {
this.contentChildren[i].detectChanges(throwOnChange);
var child = this.contentChildren[i];
if (child.cdMode === ChangeDetectionStrategy.Detached) continue;
child.detectChanges(throwOnChange);
}
}

detectViewChildrenChanges(throwOnChange: boolean) {
for (var i = 0; i < this.viewChildren.length; ++i) {
this.viewChildren[i].detectChanges(throwOnChange);
var child = this.viewChildren[i];
if (child.cdMode === ChangeDetectionStrategy.Detached) continue;
child.detectChanges(throwOnChange);
}
}

Expand Down

0 comments on commit 6028368

Please sign in to comment.