Angular 2 - How to access directives from Component
You can query the view children by:
@Component({ selector: 'case-index', templateUrl: 'client/app/case/case.index.html', directives : [ModalNewCaseComponent]})export class CaseIndexComponent { @ViewChild(ModalNewCaseComponent) modal: ModalNewCaseComponent; afterViewInit() { // this.modal will have value } doShowStartNewCase(event: any) { // how can I access the ModalNewCaseComponent } }
You can find more about ViewChildren and ContentChildren here.