app.module.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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: [/*MyCoolComponent, MyHotComponent*/],
  22. entryComponents: [/*MyCoolComponent, MyHotComponent*/],
  23. providers: [
  24. {
  25. provide: APP_BOOTSTRAP_LISTENER,
  26. multi: true,
  27. useFactory: () => {
  28. return (component: ComponentRef<BootstrapComponent>) => {
  29. //When ng9 part is bootstrapped continue with AngularJs modules
  30. component.instance.upgrade.bootstrap(
  31. document.documentElement,
  32. [app.name],
  33. {strictDi: true}
  34. );
  35. };
  36. },
  37. },
  38. AppService,
  39. ],
  40. })
  41. export class AppModule {
  42. constructor() {}
  43. ngDoBootstrap(appRef: ApplicationRef): void {
  44. //First bootstrap Angular 9 app part on hs element
  45. appRef.bootstrap(BootstrapComponent);
  46. }
  47. }