Get response header in then() function of a ngResource object's $promise property after resource resolved?

后端 未结 3 1460
醉梦人生
醉梦人生 2021-02-07 23:37

I\'m willing to retrieve the response header of a resource request, cause I\'ve put pagination information and something else in it rather than the response body, to make the RE

3条回答
  •  灰色年华
    2021-02-08 00:11

    We can't use .then for returning the header because the promise doesn't allow for multiple return values. (e.g., (res, err))

    This was a requested feature, and was closed https://github.com/angular/angular.js/issues/11056

    ... the then "callbacks" can have only [one] argument. The reason for this is that those "callbacks" correspond to the return value / exception from synchronous programming and you can't return multiple results / throw multiple exceptions from a regular function.

提交回复
热议问题