vikash
vikash

Reputation: 23

app.component.ts:65 DELETE http://localhost:3000/employees/$%7Bid%7D 404 (Not Found)

deleteemployee(id: number): Observable<any> {
return this._http.delete('http://localhost:3000/employees/${id}');

} }

error:HttpErrorResponse {headers: HttpHeaders, status: 404, statusText: 'Not Found', url: 'http://localhost:3000/employees/$%7Bid%7D', ok: false, …} error : {} headers : HttpHeaders {normalizedNames: Map(0), lazyUpdate: null, lazyInit: ƒ} message : "Http failure response for http://localhost:3000/employees/$%7Bid%7D: 404 Not Found" name : "HttpErrorResponse" ok : false status : 404 statusText : "Not Found" url : "http://localhost:3000/employees/$%7Bid%7D" [[Prototype]] : HttpResponseBase

Upvotes: 0

Views: 212

Answers (1)

Random
Random

Reputation: 3236

to use the ${} syntax, you have to use backquotes instead of quotes:

return this._http.delete(`http://localhost:3000/employees/${id}`);

Upvotes: 0

Related Questions