Created
October 23, 2012 15:28
-
-
Save guillaumepiot/3939452 to your computer and use it in GitHub Desktop.
ANGULARJS - Django CSRF Token header setup
This file contains hidden or 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
var myApp = angular.module('myApp').config(function($httpProvider) { | |
$httpProvider.defaults.headers.post['X-CSRFToken'] = $('input[name=csrfmiddlewaretoken]').val(); | |
}); |
I can't remember sorry, haven't worked with Angular in years...
Looks like it's when you initialize your app, which is the html element with tag ng-app="myApp"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Where do I place this code.?