I am building an angular 2 application. Is is a small one, has 3 to 5 components and is based on the tutorial.
I learned how to share date via a Service
for more than one Component
by adding it into the array of the bootsrap
function in my main.ts
.
Is there something similar for ROUTER_DIRECTIVES
. I want to make all my routes available to all components. I want to add routerLinks
in some of the templates, but if I don't add the ROUTER_DIRECTIVES
into the directives array as meta data for the component, I cant use the routerLink.
My question is, can I avoid this snippet by defining a global ROUTER_DIRECTIVES
for every component in my application?
@Component({
selector: 'players',
templateUrl: 'app/players.html',
directives: [ROUTER_DIRECTIVES]
})
export class PlayersComponent {}