mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00: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:
parent
8363db4189
commit
215db7fbe6
1 changed files with 2 additions and 1 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue