I have a button in the chlid component which has a form, on click of the button, it adds in DB and gives out an alert. I want to display the alert in the parent component screen which shows the list of data in DB.
HTML:
<button class="pt-primary adconfig-button" *ngIf="!isEditMode" [disabled]="!testSuccessful" (click)="storeNewConnection()">Add Configuration</button>
TS:
this.adService.addAdConfiguration(this.adConfigurationObj, this.isEditMode).subscribe((response) => {
const msg: string = response.Status === ResultStatus.Success ? this.alerts.push(
{
msg: 'Configuration added successfully!',
type: 'success',
timeout: 3000
}) : response.Details;
});
}
this.router.navigate(['/configuration/groups-permissions'], { state: { isAdConfig: true } });
I want to route to this path (parent component) and display the alert there.
How can accomplish it?