Skip to content

Commit 2c9da1d

Browse files
committed
fix(elements): initialization should run in ngZone (angular#24181)
1 parent 5a43467 commit 2c9da1d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

packages/elements/src/component-factory-strategy-zone.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class ComponentNgElementZoneStrategyFactory extends ComponentNgElementStr
2222
}
2323

2424
/**
25-
* extends ComponentNgElementStrategy to insure callbacks run in the Angular zone
25+
* extends ComponentNgElementStrategy to ensure callbacks run in the Angular zone
2626
*
2727
* @experimental
2828
*/
@@ -35,20 +35,20 @@ export class ComponentNgElementZoneStrategy extends ComponentNgElementStrategy {
3535
}
3636

3737
connect(element: HTMLElement) {
38-
this.insureAngularZone(() => { super.connect(element); });
38+
this.runInZone(() => { super.connect(element); });
3939
}
4040

41-
disconnect() { this.insureAngularZone(super.disconnect); }
41+
disconnect() {
42+
this.runInZone(() => { super.disconnect(); });
43+
}
4244

4345
getInputValue(propName: string) {
44-
return this.insureAngularZone(() => { return super.getInputValue(propName); });
46+
return this.runInZone(() => { return super.getInputValue(propName); });
4547
}
4648

4749
setInputValue(propName: string, value: string) {
48-
this.insureAngularZone(() => { super.setInputValue(propName, value); });
50+
this.runInZone(() => { super.setInputValue(propName, value); });
4951
}
5052

51-
private insureAngularZone(fn: () => any) {
52-
return NgZone.isInAngularZone() ? fn() : this.ngZone.run(fn);
53-
}
53+
private runInZone(fn: () => any) { return NgZone.isInAngularZone() ? fn() : this.ngZone.run(fn); }
5454
}

0 commit comments

Comments
 (0)