Angular 5 service call not working based on modal result

170 views Asked by At

I have a delete button on the table when user click delete button basically I would like to ask confirmation from the user for delete. If use clicked yes I need to make service call. I'm facing an issue when I making service call. Below is my code and I have attached the error as well.

delete (id) {
    this.modalRef = this.modalService.show(ConfirmationModalComponent);
    this.modalRef.content.onClose.subscribe(result => {
        if (result === true) {
            this.userService.deleteUser(id).subscribe(response => {
                alert("Record deleted successfully");
            });
        }
    });
} 

enter image description here

0

There are 0 answers