How to call another components function in angular2
<p>I have two components as follows and I want to call a function from another component. Both components are included in the third parent component using directive.</p>



<p>Component 1:</p>

<pre class="lang-js prettyprint-override"><code>@component(
    selector:'com1'
)
export class com1{
    function1(){...}
}
</code></pre>

<p>Component 2:</p>

<pre class="lang-js prettyprint-override"><code>@component(
    selector:'com2'
)
export class com2{
    function2(){...
        // i want to call function 1 from com1 here
    }
}
</code></pre>

<p>I've tried using <code>@input</code> and <code>@output</code> but I don't understand exactly how to use it and how to call that function, can anyone help?</p>