Advertisement
Guest User

Untitled

a guest
Oct 14th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. var app = angular.module('demoApp', ['ngResource', 'ngRoute']);
  2.  
  3. app.config(function ($routeProvider, $locationProvider, $httpProvider) {
  4. $httpProvider.defaults.xsrfCookieName = 'csrf_token';
  5. $httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken';
  6. $httpProvider.defaults.withCredentials = true;
  7. });
  8.  
  9. app.controller('LoginController', ['$scope', ' $http',
  10. function ($scope, $http) {
  11. $scope.login = function(){
  12. console.log($scope.username);
  13. console.log($scope.password);
  14. $http({
  15. method: 'POST',
  16. url: 'http://127.0.0.1:8000/login/',
  17. headers: {
  18. 'Content-Type': 'application/json'
  19. },
  20. data: {
  21. username: $scope.username,
  22. password: $scope.password
  23. }
  24. })
  25. }
  26. }
  27. ]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement