javascript - AngularJS, How to correctly modify http headers in a factory -
javascript - AngularJS, How to correctly modify http headers in a factory -
i hoping angular guru can point me in right direction. when using mill in format below, how modify header post that:
'content-type':'application/x-www-form-urlencoded; charset=utf-8'?
the code:
var tablemodule = angular.module('theapp', ['ui-rangeslider','ngscrollbar']); tablemodule.factory('services', ['$http', function($http) { homecoming { : function($path, callback) { homecoming $http.get($path).success(callback); }, post : function($path, $data, callback) { homecoming $http.post($path, $data).success(callback); } }; }]);
why not utilize 3rd config argument $http.post
...
post: function(path, data) { homecoming $http.post(path, data, { headers: { 'content-type': 'application/x-www-form-urlencoded' } }); }
javascript angularjs factory
Comments
Post a Comment