I am trying to call a public function which is inside my directive from component by getting hold of the directive via viewchild like this
@ViewChild(\'myDi
DEMO - How to call Directive's function from Component - check browser's console
import {myDirective} from './Directive';
2)
@ViewChild(myDirective) vc:myDirective; ///<<<@@@removed '' from ('myDirective')
3)
ngAfterViewInit(){
this.vc.myFunction(); ///<<@@@ no need to use nativeElement
}
4) Or some button's click event
click(){
this.vc.myFunction();
}