lazyBootAngular.ts 494 B

1234567891011121314151617181920212223
  1. import { auto } from 'angular';
  2. let injector: auto.IInjectorService | undefined;
  3. /**
  4. * Future poc to lazy load angular app, not yet used
  5. */
  6. export async function getAngularInjector(): Promise<auto.IInjectorService> {
  7. if (injector) {
  8. return injector;
  9. }
  10. const { AngularApp } = await import(/* webpackChunkName: "AngularApp" */ './index');
  11. if (injector) {
  12. return injector;
  13. }
  14. const app = new AngularApp();
  15. app.init();
  16. injector = app.bootstrap();
  17. return injector;
  18. }