Advertisement
Guest User

Untitled

a guest
May 9th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. 'use strict';
  2.  
  3. angular.module('myApp.view1', ['ngRoute'])
  4.  
  5. .config(['$routeProvider', function($routeProvider) {
  6. $routeProvider.when('/view1', {
  7. templateUrl: 'view1/view1.html',
  8. controller: 'AuthCtrl as auth'
  9. });
  10. }])
  11.  
  12. .controller('AuthCtrl', ['$http',function($http) {
  13.  
  14. let auth = this;
  15.  
  16. auth.login = function() {
  17.  
  18. console.log(auth.username)
  19. console.log(auth.password)
  20.  
  21. $http.post('/js/cake/login',
  22. {username: auth.username,password: auth.password},
  23. {headers:{'Content-Type': 'application/x-www-form-urlencoded'}}).then(function () {
  24. //success
  25. console.log(arguments)
  26. }, function() {
  27. //fail
  28. console.log(arguments)
  29. })
  30.  
  31. }
  32.  
  33. }]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement