How can I detect a change happening in a sibling?
If I have this parent template calling the children:
<app-first-sibling></app-first-sibling>
<app-second-sibling></app-second-sibling>
Then in the first sibling template I have this:
<select (change)="onSelectChange()">
<option>Test</option>
<option>Test2</option>
</select>
Is there a way to trigger the onSelectChange() event within the second sibling?
export class SecondSiblingComponent {
// onSelectChange() of first-sibling
onSelectChange(){
alert("Hello");
}
}
So when I choose something in the selectbox I want to trigger the method sending alert("Hello");
Live example: https://stackblitz.com/edit/angular-hjrat3