Delete Data

onDeletePost(post: { id: any; title: string }) {
  this.http.delete(`${this.url}/${post.id}`).subscribe(() => {
    // Upon success, remove post from local array
    this.posts = this.posts.filter((p) => p.id !== post.id);
  });
}
Was this page helpful?