If I declare component
inline I can execture directive on it
<stuff1-component my-directive></stuff1-component>
Is there any way to do something similar but in case of using angular2
component router
?
@RouteConfig([
{ path: '/route1', name: 'Stuff1', component: Stuff2Component, directive: my-directive },
{ path: '/route2', name: 'Stuff2', component: Stuff2Component },
])
The reason I need to do that because I need to apply some behaivour to MDL component which I implemented as directive Integrating Material Design Lite with Angular2.
import {Directive, AfterViewInit} from 'angular2/core';
declare var componentHandler;
@Directive({
selector: '[mdl]'
})
export class MDL implements AfterViewInit {
ngAfterViewInit() {
componentHandler.upgradeAllRegistered();
}
}