In my child component when I got a success from api call i am emiting data to parent component. But it’s not working.
ChildComponent.ts
taskCompleted(taskId: number) {
const patchObject: patchDocument = {
path: 'IsCompleted',
op: 'replace',
value: true,
};
const patchObjectArray: patchDocument[] = [patchObject];
this.todoService.completeTask(taskId, patchObjectArray).subscribe({
next: () => {
this.refreshTasks.emit(); //emiting data to parent for refresh
this.toaster.info('Task Completed');
},
error: (error) => {
this.toaster.error(error);
},
});
}
parentComponent.html
<app-task-details-popup (refreshTasks)="refreshTasks()"></app-task-details-popup>
parentComponent.ts
refreshTasks() {
this.getTasks(); //another api call to get tasks from db
}
}
The method refreshTasks()
is not been called from child also. This are the refrence links
1
2
New contributor
Sanju Chilukuri is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.