If you update the list in the component, the table will update automatically. Example after confirming the delete operation:
import { Component } from '@angular/core';
import { Interface } from '../..//model/interface.model'
import { InterfaceService } from '../../service/interface.service'
import { ButtonModule } from 'primeng/primeng';
import { ConfirmDialogModule, ConfirmationService } from 'primeng/primeng';
@Component({
templateUrl: './interfaces.component.html'
})
export class InterfacesComponent {
interfaces: Interface[];
constructor(
private interfaceService: InterfaceService,
private confirmationService: ConfirmationService
) { }
ngOnInit() {
this.find();
}
find() {
this.interfaceService.query().then(interfaces => this.interfaces = interfaces);
}
confirm(id: number) {
this.confirmationService.confirm({
message: 'Are you sure that you want to delete this record?',
accept: () => {
this.interfaceService.delete(id).then((_interface) => {
this.find();
});
}
});
}
}
source
share