fiuhonors / myhonors-old

A fast, modern infrastructure and social base for students, faculty, and staff. Developed for The Honors College at Florida International University.
http://myhonors.fiu.edu
2 stars 1 forks source link

Set default Content-Type for post requests in AngularJS #20

Open sergiopantoja opened 11 years ago

sergiopantoja commented 11 years ago

Just define the behavior globally. This will make all of our $http.post() calls more concise and readable.

$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded";

See http://stackoverflow.com/a/13490145/1787412

And see (for a more detailed explanation): http://victorblog.com/2012/12/20/make-angularjs-http-service-behave-like-jquery-ajax/