0
我使用$ httpBackend模擬後端,並且當我有請求時我想訪問標題:
$httpBackend.whenPOST('/movies').respond(function(method, url, data) {
// How do I get access to the headers.
// I want to check the headers and retrieve a token.
var params = angular.fromJson(data),
movie = MoviesDataModel.addOne(params),
movieId = movie.id; // get the id of the new resource to populate the Location field
return [201, movie, { Location: '/movies/' + movieId }];
});
基本上,我想在發送數據之前檢查頭中的值。
關於如何做到這一點的任何想法?