Forked from s9tpepper/modifyAngularDefaultRequestContentTypeHeader.js
Created
February 26, 2013 12:48
-
-
Save glagola/5038200 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The .config() part is the relevant part, 'SomeModule' is arbitrary name, | |
// but this config() call goes on your main ng-app="YourAppModule" | |
// The PHP $_POST expects data w/ a form content type, not a JSON payload | |
angular.module("YourAppModule", ["SomeModule"]).config(function($httpProvider) { | |
$httpProvider.defaults.headers.put['Content-Type'] = | |
'application/x-www-form-urlencoded'; | |
$httpProvider.defaults.headers.post['Content-Type'] = | |
'application/x-www-form-urlencoded'; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment