grafana/public/app/angular/lazyBootAngular.ts
Torkel Ödegaard c96c92d712
Angular: Isolate angular more (#41440)
* Getting close

* Restore angular app boot at startup

* Moving angular annotations dependencies to app/angular or old graph

* Remove redundant setLinkSrv call

* Fixing graph test

* Minor refactor based on review feedback

* Create in get function
2021-11-10 11:05:36 +01:00

24 lines
494 B
TypeScript

import { auto } from 'angular';
let injector: auto.IInjectorService | undefined;
/**
* Future poc to lazy load angular app, not yet used
*/
export async function getAngularInjector(): Promise<auto.IInjectorService> {
if (injector) {
return injector;
}
const { AngularApp } = await import(/* webpackChunkName: "AngularApp" */ './index');
if (injector) {
return injector;
}
const app = new AngularApp();
app.init();
injector = app.bootstrap();
return injector;
}