SIGN IN SIGN UP
angular / angular.js UNCLAIMED

AngularJS - HTML enhanced for web apps!

0 0 181 JavaScript

feat($http): accept function as headers value

So we can request with dynamic header value.

module.factory('Res', [
  '$resource'
  '$routeParams'
  'globalConfig'

function($resource, $routeParams, globalConfig) {
  resource('/url/:id', {id: "@id"}, {
    patch: {
      method: 'patch',
      headers: {
        'Authorization': function() {
          return "token " + globalConfig.token;
        }
      }
    }
  });
}]);
B
bolasblack committed
a7150f1256f2a97a931b3c0d16eab70f45e81cae
Parent: 0d124e1
Committed by Igor Minar <igor@angularjs.org> on 7/8/2013, 3:55:20 PM