feat(ChangeDetectorRef): make detectChanges() correct

Closes #8599
This commit is contained in:
laco0416 2016-05-12 01:05:39 +09:00 committed by Tobias Bosch
parent 2953ea10a7
commit 602836800b
1 changed files with 7 additions and 4 deletions

View File

@ -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) {
@ -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);
}
}