2016-08-23 49 views
3

我是新来的角2定义的方法,我已经注入指令在当前Component如何调用一个角2指令

@Component({ 
    selector: 'select-me', 
    templateUrl: 'app/template.html', 
    directives: [BackgroundChange] // I want to access this same instance to make the dynamic changes 
}) 

export class PageComponent { 
constructor(private backgroundChange:BackgroundChange) { 
// I guess this will create new instance of BackgroundChange 
} 

} 

我想打电话给在BackgroundChange速效方法从PageComponent动态地做一些改变

回答