Looking to remove data from a restful webservice using Angular. Initially followed the method outlined in the Angular tutorial site:
delete(id: number): Promise<void> {
const url = `${this.heroesUrl}/${id}`;
return this.http.delete(url, {headers: this.headers})
.toPromise()
.then(() => null)
.catch(this.handleError);
}
Although it works, I'm interested in achieving the same result using observables instead of promises. Tried the following approach, but encountered issues:
delete(id: number) {
const url = '${this.heroesUrl}/${id}';
return this.http.delete(url).map(
response => {},
error => console.log(error)
);
}