main.ts 928 B

1234567891011121314151617181920212223242526272829303132
  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. import { logger } from './root-helpers'
  7. if (environment.production) {
  8. enableProdMode()
  9. }
  10. logger.registerServerSending(environment.apiUrl)
  11. const bootstrap = () => platformBrowserDynamic()
  12. .bootstrapModule(AppModule)
  13. .then(bootstrapModule => {
  14. if (!environment.production) {
  15. const applicationRef = bootstrapModule.injector.get(ApplicationRef)
  16. const componentRef = applicationRef.components[0]
  17. // allows to run `ng.profiler.timeChangeDetection();`
  18. enableDebugTools(componentRef)
  19. }
  20. return bootstrapModule
  21. })
  22. .catch(err => {
  23. logger.error(err)
  24. return null
  25. })
  26. bootstrap()