2016-08-23 20 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動態地做一些改變

回答