Is it possible to access angular(2+) ZoneJS instance (NgZone) without injecting it inside constructor like this:
...
const zone = window['<angular zonejs path in window object>']
...
For now when I developing my angular library I need to do this:
class Test {
constructor( zone: NgZone ) { initmyplugin(zone); }
}
But I don't wanna user to care about initialization of NgZone.
You can get hold of NgZone
instance by using the following code:
ng.probe(getAllAngularRootElements()[0]).injector.get(ng.coreTokens.NgZone)
See also