You could archieve this by means of ViewChild
and Output
For example:
@Component({
template: `
<child-one (clicked)="handleClick()"></child-one>
<child-two></child-two>
`
})
export class ParentComponent {
@ViewChild(ChildOneComponent)
childOne: ChildOneComponent;
handleClick(){
this.childOne.doSomething();
}
}
In this case:
clicked
is an Ouput
property of ChildOneComponent
doSomething
is a public method
Another approach only ussing Output
and a template variable
@Component({
template: `
<child-one (clicked)="childTwo.doSomething()"></child-one>
<child-two #childTwo></child-two>
`
})
export class ParentComponent {
}