main.ts 839 B

1234567891011121314151617181920212223242526272829
  1. import { ApplicationRef, enableProdMode } from '@angular/core'
  2. import { enableDebugTools } from '@angular/platform-browser'
  3. import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'
  4. import { AppModule } from './app/app.module'
  5. import { environment } from './environments/environment'
  6. if (environment.production) {
  7. enableProdMode()
  8. }
  9. const bootstrap = () => platformBrowserDynamic()
  10. .bootstrapModule(AppModule)
  11. .then(bootstrapModule => {
  12. if (!environment.production) {
  13. const applicationRef = bootstrapModule.injector.get(ApplicationRef)
  14. const componentRef = applicationRef.components[0]
  15. // allows to run `ng.profiler.timeChangeDetection();`
  16. enableDebugTools(componentRef)
  17. }
  18. return bootstrapModule
  19. })
  20. .catch(err => {
  21. console.error(err)
  22. return null
  23. })
  24. bootstrap()