Angular: Custom headers are ignored by $http and $resource. Why?

前端 未结 3 1547
夕颜
夕颜 2021-02-14 21:23

I\'m trying to access a REST service I don\'t control. First problem is that the service doesn\'t include a Access-Control-Allow-Origin header, which is a problem that, if I und

3条回答
  •  庸人自扰
    2021-02-14 21:38

    I think your answer is here. According to the wiki, A JSONP call is executed through injection of a

    The content of the response to http://headers.jsontest.com/?callback=angular.callbacks._1 will be:

    angular.callbacks._1({key1: "value1", key2: "value2"});
    

    angular.callbacks._1 will contain your success function, and it will be called with the data.

提交回复
热议问题