on-internet
← Community

Execute method on child component

Stack Overflow ·

I have a parent component and a child component. I want to be able to call some child method on the child component from some method on the parent component. Is there a way to get a reference to the child component instance on the parent's class and call child's public methods? @Component({ selector: 'child-component' }) @View({ template: `<div>child</div>` }) class ChildComponent{ constructor () { } doChildEvent () { // some child event } } @Component({ selector: 'parent-component' }) @View({ template: ` <child-component #child></child-component> `, directives: [ ChildComponent ] }) class Par

Comments

Sign in or sign up to comment and upvote.

No comments yet.