The HTML Content :
<td>
<a (click)="onDelete(item.id)">
<i class="material-icons" style="font-weight:bold; font-style:inherit ;color: rgba(247, 37, 37, 0.884);">
delete_outline
</i>
</a>
</td>
The corresponding TS File :
onDelete(id) {
console.log(id);
this.blogId = this.id;
const status = window.confirm('Are you sure you want to delete this id?' + this.blogId);
if (status) {
this.blog.deleteBlog(this.blogId).subscribe((response) => {
this.blogId = (Response);
alert('Successfully deleted the id');
this.route.navigate(['/admin/blogger']);
}, (error) => {
console.log(error);
});
}
And the service file :
deleteBlog(id: any) {
return this.http.delete(this.mainUrl + '/blog/' + id);
}
I encountered an error in the console when passing the id as a parameter for deleting a specific record. I am unsure of my mistake here. Thank you in advance.