-1

I can call delete for an event successfully using postman

http://localhost:8080/test/api/events/18

{"Content-Type":"application/json"}

and it works.

I make call on same url from angular 2 app like following:

let headers = new Headers({ 'Content-Type': 'application/json' });
let options = new RequestOptions({ headers: headers });
let url = "http://localhost:8080/test/api/events/18";

this.http.delete(url, options);
or 
this.http.delete(url)

is not reaching server.

Paperless
  • 45
  • 6
  • 1
    Possible duplicate of [Angular 2 http get not getting](http://stackoverflow.com/questions/41381200/angular-2-http-get-not-getting) – jonrsharpe Apr 19 '17 at 17:07

1 Answers1

1

You need to subscribe to get it work. http is Angular 2 returns observable and they are lazy.

this.http.delete(url, options).subscribe(x=>console.log(x))
Julia Passynkova
  • 17,256
  • 6
  • 33
  • 32