An open API service indexing awesome lists of open source software.

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

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.