app.module.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import 'core-js/es6/reflect';
  2. import 'core-js/es7/reflect';
  3. import 'reflect-metadata';
  4. import 'zone.js';
  5. import app from './app-js';
  6. import {
  7. APP_BOOTSTRAP_LISTENER,
  8. ApplicationRef,
  9. ComponentRef,
  10. NgModule,
  11. } from '@angular/core';
  12. import {BrowserModule} from '@angular/platform-browser';
  13. import {UpgradeModule} from '@angular/upgrade/static';
  14. import {BootstrapComponent} from 'hslayers-ng/bootstrap.component';
  15. import {HsCoreModule} from 'hslayers-ng/components/core/core.module';
  16. import {AdjusterModule} from './adjuster';
  17. import {AppService} from './app.service';
  18. @NgModule({
  19. imports: [BrowserModule, UpgradeModule, HsCoreModule, AdjusterModule],
  20. exports: [],
  21. declarations: [],
  22. providers: [
  23. {
  24. provide: APP_BOOTSTRAP_LISTENER,
  25. multi: true,
  26. useFactory: () => {
  27. return (component: ComponentRef<BootstrapComponent>) => {
  28. //When ng9 part is bootstrapped continue with AngularJs modules
  29. component.instance.upgrade.bootstrap(
  30. document.documentElement,
  31. [app.name],
  32. {strictDi: true}
  33. );
  34. };
  35. },
  36. },
  37. AppService,
  38. ],
  39. })
  40. export class AppModule {
  41. constructor() {}
  42. ngDoBootstrap(appRef: ApplicationRef): void {
  43. //First bootstrap Angular 9 app part on hs element
  44. appRef.bootstrap(BootstrapComponent);
  45. }
  46. }