Advertisement
Guest User

Untitled

a guest
Feb 24th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. //our root app component
  2. import {Component, NgModule} from '@angular/core'
  3. import {BrowserModule} from '@angular/platform-browser'
  4.  
  5. @Component({
  6. selector: 'my-app',
  7. template: `
  8. <div>
  9. <h2>Hello {{name}}</h2>
  10. </div>
  11. `,
  12. })
  13. export class App {
  14. constructor() {
  15. this.name = 'app'
  16. }
  17. }
  18.  
  19. @Component({
  20. selector: 'my-app2',
  21. template: `
  22. <div>
  23. <h2>Hello {{name}}</h2>
  24. </div>
  25. `,
  26. })
  27. export class App2 {
  28. constructor() {
  29. this.name = 'app2'
  30. }
  31. }
  32.  
  33. @NgModule({
  34. imports: [ BrowserModule ],
  35. declarations: [ App, App2 ],
  36. entryComponents: [ App, App2 ]
  37. })
  38. export class AppModule {
  39. ngDoBootstrap(appRef:ApplicationRef){
  40. appRef.bootstrap(App);
  41. appRef.bootstrap(App2);
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement