I am having a bit of trouble understanding the logic here
root-component
import { Component } from \"angular2/core\";
import { TopNavigationComponent } f
As @Bhavik said ROUTER_DIRECTIVES
is required everytime you use RouterLink
or RouterOutlet
(you can specify each one of them as well).
Check the source code for Router
export const ROUTER_DIRECTIVES: any[] = CONST_EXPR([RouterOutlet, RouterLink]);
Obviously adding it everytime you're using either of one of them is annoying, so you can make it simpler by using PLATFORM_DIRECTIVES. This way you'll add it once in your application and it will be available across of it.
bootstrap(App, [
provide(PLATFORM_DIRECTIVES, {useValue: [ROUTER_DIRECTIVES], multi: true})
]);
Note that there's an issue open proposing to add ROUTER_DIRECTIVES
to ROUTER_PROVIDERS
, so we can even skip the solution suggested above. That would make setting up Router much easier.