0

I have a service that is consumed via jQuery and everything works ok. Now it is being consumed by Angular, but Angular does not send as POST / GET, it sends everything as OPTIONS.

I've changed the settings in the service to configure CORS. But I think it is right to find out why Angular does not send as POST / GET.

peterh
  • 9,698
  • 15
  • 68
  • 87
Klev
  • 11
  • 1
    if that is in Portuguese try http://pt.stackoverflow.com/ Otherwise please translate to English – charlietfl Sep 18 '15 at 16:04
  • provide the angular code you are using.. are yo using the $http or the $resource, not nearly enough info :/ if $http, looks like $http.get() would send get.. https://docs.angularjs.org/api/ng/service/$http – Tony Sep 18 '15 at 16:19
  • possible duplicate of [AngularJS performs an OPTIONS HTTP request for a cross-origin resource](http://stackoverflow.com/questions/12111936/angularjs-performs-an-options-http-request-for-a-cross-origin-resource) – Neil S Sep 18 '15 at 16:51
  • Many reviewers has a lot to do and don't read the english part of the bottom, this is why I removed any non-english text. – peterh Sep 18 '15 at 19:15

1 Answers1

2

Angular sends an OPTIONS request first to check the status of the CORS request before sending the actual GET or POST request. If the OPTIONS request does not have the appropriate CORS headers, the error is generated and the GET or POST request is not sent.

Neil S
  • 2,263
  • 19
  • 26