Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var app = angular.module('demoApp', ['ngResource', 'ngRoute']);
- app.config(function ($routeProvider, $locationProvider, $httpProvider) {
- $httpProvider.defaults.xsrfCookieName = 'csrf_token';
- $httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken';
- $httpProvider.defaults.withCredentials = true;
- });
- app.controller('LoginController', ['$scope', ' $http',
- function ($scope, $http) {
- $scope.login = function(){
- console.log($scope.username);
- console.log($scope.password);
- $http({
- method: 'POST',
- url: 'http://127.0.0.1:8000/login/',
- headers: {
- 'Content-Type': 'application/json'
- },
- data: {
- username: $scope.username,
- password: $scope.password
- }
- })
- }
- }
- ]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement