Skip to content

Latest commit

 

History

History
29 lines (21 loc) · 960 Bytes

README.md

File metadata and controls

29 lines (21 loc) · 960 Bytes

angular-django-csrf

creates an AngularJS $http interceptor which adds the CSRF token for Django use

Install

$ bower install angular-django-csrf

Usage

  • Make sure the angular-django-csrf.js file is added to your index.html
  • Add the angularDjangoCsrf module to the list of your app dependencies
  • Ensure that you have ngCookies loaded in your app as well

Add a <script> to your index.html:

<script src="/bower_components/angular-cookies/angular-cookies.js"></script>
<script src="/bower_components/angular-django-csrf/angular-django-csrf.js"></script>

And add angularDjangoCsrf as a dependency for your app:

angular.module('myApp', ['ngCookies', 'angularDjangoCsrf']);

Dependencies

ngCookies is a required dependency of this module.