Issue
I am doing angular crud operation using JSON server, post and get are working properly but delete is not working DELETE /posts1 404. My code is as follows -
deleteEmployee(id : number){
return this.http.delete<any>("http://localhost:3000/posts"+id)
.pipe(map((res:any)=>{
return res;
})
DELETE http://localhost:3000/posts1 404 (Not Found)
Solution
fix url
return this.http.delete<any>("http://localhost:3000/posts/"+id)
or maybe
return this.http.delete<any>("http://localhost:3000/posts?id="+id)
Answered By - Serge
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.