i need to delete the object real-time from frontend as well as backend my, The object gets deleted from the backend instantly but it do not reflects in the frontend till the page is refreshed
//delete component
deleteStory(id : string){
console.log(id)
this.storyapiService.deleteStory(id).subscribe();
}
service.ts
deleteStory(id: string): Observable<number>{
return this.http.delete<number>(this.API_URL +id);
}
//html
<button class="btn btn-primary" (click)="deleteStory(story.id)" style="margin-left:5px">Delete </button>
Try to get data again once you delete the element to refresh the current view.
Hope it works!