Calling function in directive : <p>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</p>

<pre><code> @ViewChild('myDirective') myDirective;
 ....
 myDirective.nativeElement.myFunction();
</code></pre>

<p>But I get error that the myFunction does not exist.
Is there a way to call a function which is iniside a directive?</p>
