You can use @output() to fire an event from the child component to the parent component once the button has clicked.
In your child component template (HTML):
<button type="button" (click)="onClickChlidComponent()">Click me</button>
The child component typescript file:
import {Output, EventEmitter} from '@angular/core';
@Component({
selector:'x-component',
})
export class XComponent{
@Output() buttonXClicked = new EventEmitter();
onClickChlidComponent(){
this.buttonXClicked.emit(null);//You can pass whatever you want throw the output
}
}
Your parent component template is:
<x-component (buttonXClicked)="onChildXButtonClicked($event)"></x-component>
Your parent component typescript:
onChildXButtonClicked(outputData:any){
alert('button on the x component has clicked');
}