Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. 'use strict';
  2.  
  3. var userModule = angular.module('userModule', ['userServices']);
  4.  
  5. userModule.controller('LoginController', ['$scope', '$location', 'userAuth', function($scope, $location, userAuth) {
  6.  
  7. $scope.login = function() {
  8. console.log("username: " + $scope.email + ", password: " + $scope.password);
  9. // userAuth.login($scope.username, $scope.password);
  10.  
  11. // initial values
  12. $scope.error = false;
  13. $scope.disabled = true;
  14.  
  15. // call login from service
  16. userAuth.login($scope.email, $scope.password)
  17. // handle success
  18. .then(function () {
  19. console.log('I am in then function');
  20. })
  21. .catch(function () {
  22.  
  23. })
  24. };
  25.  
  26. }]);
  27.  
  28. TypeError: userAuth.login(...).then(...).catch is not a function
  29. at Object.$scope.login (http://localhost:5000/static/js/controllers/user.js:28:13)
  30. at http://localhost:5000/static/lib/angular/angular.js:6365:19
  31. at Object.Scope.$eval (http://localhost:5000/static/lib/angular/angular.js:8057:28)
  32. at Object.Scope.$apply (http://localhost:5000/static/lib/angular/angular.js:8137:23)
  33. at HTMLFormElement.<anonymous> (http://localhost:5000/static/lib/angular/angular.js:13159:11)
  34. at http://localhost:5000/static/lib/angular/angular.js:1992:10
  35. at Array.forEach (native)
  36. at forEach (http://localhost:5000/static/lib/angular/angular.js:130:11)
  37. at HTMLFormElement.eventHandler (http://localhost:5000/static/lib/angular/angular.js:1991:5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement