Skip to content

Commit 6028368

Browse files
laco0416tbosch
authored andcommitted
feat(ChangeDetectorRef): make detectChanges() correct
Closes #8599
1 parent 2953ea1 commit 6028368

File tree

1 file changed

+7
-4
lines changed
  • modules/@angular/core/src/linker

1 file changed

+7
-4
lines changed

modules/@angular/core/src/linker/view.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,7 @@ export abstract class AppView<T> {
279279

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

305304
detectContentChildrenChanges(throwOnChange: boolean) {
306305
for (var i = 0; i < this.contentChildren.length; ++i) {
307-
this.contentChildren[i].detectChanges(throwOnChange);
306+
var child = this.contentChildren[i];
307+
if (child.cdMode === ChangeDetectionStrategy.Detached) continue;
308+
child.detectChanges(throwOnChange);
308309
}
309310
}
310311

311312
detectViewChildrenChanges(throwOnChange: boolean) {
312313
for (var i = 0; i < this.viewChildren.length; ++i) {
313-
this.viewChildren[i].detectChanges(throwOnChange);
314+
var child = this.viewChildren[i];
315+
if (child.cdMode === ChangeDetectionStrategy.Detached) continue;
316+
child.detectChanges(throwOnChange);
314317
}
315318
}
316319

0 commit comments

Comments
 (0)