使用 angularjs 删除按钮不适用于 json 服务器
Delete Button not working with json server using angularjs
我正在使用 JSON 服务器进行 angular crud 操作,post 和 get 工作正常但删除不工作 DELETE /posts1 404。我的代码如下-
deleteEmployee(id : number){
return this.http.delete<any>("http://localhost:3000/posts"+id)
.pipe(map((res:any)=>{
return res;
})
删除 http://localhost:3000/posts1 404(未找到)
修正url
return this.http.delete<any>("http://localhost:3000/posts/"+id)
或者也许
return this.http.delete<any>("http://localhost:3000/posts?id="+id)
我正在使用 JSON 服务器进行 angular crud 操作,post 和 get 工作正常但删除不工作 DELETE /posts1 404。我的代码如下-
deleteEmployee(id : number){
return this.http.delete<any>("http://localhost:3000/posts"+id)
.pipe(map((res:any)=>{
return res;
})
删除 http://localhost:3000/posts1 404(未找到)
修正url
return this.http.delete<any>("http://localhost:3000/posts/"+id)
或者也许
return this.http.delete<any>("http://localhost:3000/posts?id="+id)