How to call another components function in angular2

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.

Component 1:

@component(
    selector:'com1'
)
export class com1{
    function1(){...}
}

Component 2:

@component(
    selector:'com2'
)
export class com2{
    function2(){...
        // i want to call function 1 from com1 here
    }
}

I’ve tried using @input and @output but I don’t understand exactly how to use it and how to call that function, can anyone help?

11 Answers
11

Leave a Comment