Angular 2, component inside main component

In this link of Angular2 web https://angular.io/docs/ts/latest/tutorial/toh-pt3.html# you can see that adding directives: [...] inside of @Components for example:

@Component({
  selector: 'my-app',
  directives: [UsersComponent]
})

but otherwise the link use template inside the component, do not know if this will work if you use @Template({ url:"app.html"}) outside component.

you can watch the file name app.appcomponet.ts for more details, hopefully help.


Angular calendar demo has two nested components (calendar and calendar-cell) https://github.com/djsmith42/angular2_calendar.git . From what I can see there your MyAppComponent should reference Users component from @Template's directives list, like this:

@Template({
  url: System.baseURL+'app/components/calendar/calendar.html',
  directives: [
    Foreach,
    If,
    CalendarCell
  ]
})

Tags:

Angular