I have a material Table with expandable rows (https://material.angular.io/components/table/examples) and I want to manage delete into the table itself, so I create a delete button with a function that trigger the delete event. The api works, the record is correctly deleted, but the table is not refreshed after delete, and I want to implement this behaviour. Here a stackblitz with fake api: https://stackblitz.com/edit/angular-comzph
I try, in my delete function to call ngOnInt and to navigate back to the same route, but nothing happens...
deleteCustomer(id) {
this.api.deleteCustomer(id)
.subscribe(res => {
alert(`cliente rimosso`);
// TODO fix reload list after delete
// this.router.navigate['/clienti'];
this.ngOnInit();
}, (err) => {
console.log(err);
}
);
}
I try to use this solution too, but does not works. I try using ngOnChange and ngOnDestroy, but does not works too...
Could someone help me?