Access angular NgZone instance from window.object
问题 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. 回答1: You can get hold of NgZone instance by using the following code: ng.probe(getAllAngularRootElements()[0]).injector