Advertisement
Guest User

Untitled

a guest
Feb 29th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. $scope.doLogin = function() {
  2.  
  3. $scope.loginSubmitted = true;
  4. $scope.loginstatus==0;
  5. authService.GetByUsername()
  6. .success(function(data) {
  7. $scope.UserData = data;
  8. console.log($scope.UserData);
  9. for (var i = 0; i < $scope.UserData.length; i++) {
  10. if ($scope.UserData[i].UserName == $scope.User.UserName && $scope.UserData[i].Password == $scope.User.Password) {
  11. $scope.loginstatus=1;
  12. break;
  13. }
  14. }
  15. if($scope.loginstatus==1){
  16. $state.go('app.single')
  17. }
  18. else {
  19. console.log('wrong credentials');
  20. }
  21.  
  22. })
  23. .error(function(err) {
  24. console.log(err);
  25. });
  26. }
  27.  
  28. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement