Skip to content

Instantly share code, notes, and snippets.

@qnub
Created March 12, 2016 06:01
Show Gist options
  • Save qnub/81d7103d695ed4c957e6 to your computer and use it in GitHub Desktop.
Save qnub/81d7103d695ed4c957e6 to your computer and use it in GitHub Desktop.
Angular hints

$http.config for Django

angular.module('MyApp').config(function($httpProvider) {
  $httpProvider.defaults.xsrfCookieName = 'csrftoken';
  $httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken';
  $httpProvider.defaults.headers
      .common['X-Requested-With'] = 'XMLHttpRequest';
  $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