https://github.com/redapesolutions/angular-django-csrf
Angular $http interceptor that adds CSRF token for Django
https://github.com/redapesolutions/angular-django-csrf
Last synced: about 1 year ago
JSON representation
Angular $http interceptor that adds CSRF token for Django
- Host: GitHub
- URL: https://github.com/redapesolutions/angular-django-csrf
- Owner: redapesolutions
- Created: 2014-08-29T06:06:07.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2016-12-04T00:47:52.000Z (over 9 years ago)
- Last Synced: 2025-06-04T20:40:19.083Z (about 1 year ago)
- Size: 5.86 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# angular-django-csrf
> creates an AngularJS [$http interceptor](https://docs.angularjs.org/api/ng/service/$http#interceptors) which adds the [CSRF](https://docs.djangoproject.com/en/dev/ref/csrf/) token for Django use
## Install
```sh
$ 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 `` to your `index.html`:
```html
<script src="/bower_components/angular-cookies/angular-cookies.js">
```
And add `angularDjangoCsrf` as a dependency for your app:
```js
angular.module('myApp', ['ngCookies', 'angularDjangoCsrf']);
```
## Dependencies
[`ngCookies`](https://docs.angularjs.org/api/ngCookies) is a required dependency of this module.