Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. @NgModule({
  2. declarations: [
  3. AppComponent
  4. ],
  5. imports: [
  6. BrowserModule,
  7. AppRoutingModule
  8. ],
  9. providers: [],
  10. entryComponents: [AppComponent]
  11. // bootstrap: [AppComponent]
  12. })
  13. export class AppModule {
  14.  
  15. ngDoBootstrap(app: ApplicationRef) {
  16. // obtain reference to the DOM element that shows status
  17. // and change the status to `Loaded`
  18. const dynamicComponentElement = document.querySelector('#sidebar');
  19. dynamicComponentElement.textContent = 'Loaded';
  20. // create DOM element for the component being bootstrapped
  21. // and add it to the DOM
  22. const componentElement = document.createElement('app-root');
  23. document.body.appendChild(componentElement);
  24. // bootstrap the application with the component
  25. app.bootstrap(AppComponent);
  26. }
  27.  
  28. }
  29.  
  30. platformBrowserDynamic().bootstrapModule(AppModule).then(ref => {
  31. // Ensure Angular destroys itself on hot reloads.
  32. if (window['ngRef']) {
  33. window['ngRef'].destroy();
  34. }
  35. window['ngRef'] = ref;
  36. // Otherise, log the boot error
  37. }).catch(err => console.error(err));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement