mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix(core): error if NgZone.isInAngularZone is called with a noop zone (#44800)
When the user opts into the noop `NgZone`, they usually still interact with the static methods on the non-noop class. This change adds a check to handle the case where zone.js hasn't been loaded. Fixes #44784. PR Close #44800
This commit is contained in:
committed by
Andrew Kushnir
parent
8363db4189
commit
215db7fbe6
@@ -153,7 +153,8 @@ export class NgZone {
|
||||
}
|
||||
|
||||
static isInAngularZone(): boolean {
|
||||
return Zone.current.get('isAngularZone') === true;
|
||||
// Zone needs to be checked, because this method might be called even when NoopNgZone is used.
|
||||
return typeof Zone !== 'undefined' && Zone.current.get('isAngularZone') === true;
|
||||
}
|
||||
|
||||
static assertInAngularZone(): void {
|
||||
|
||||
Reference in New Issue
Block a user