Guest User

Untitled

a guest
Jun 21st, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. var LoginCheckService = angular.module('LoginCheckService', []);
  2.  
  3. LoginCheckService.service('LoginCheckService', function($http, $q) {
  4. var LoginData = {
  5. Username: '',
  6. Password: ''
  7. }
  8.  
  9. this.setLoginData = function(UName, Pass){
  10. return $q(resolve, reject -> {
  11. LoginData.Username= UName;
  12. LoginData.Password = Pass;
  13. resolve('Success')
  14. })
  15. }
  16.  
  17. });
  18.  
  19. var loginApp = angular.module('loginApp', ['LoginCheckService']);
  20. loginApp.controller('MainCtrl', function ($scope, $http, $window, LoginCheckService) {
  21.  
  22. $scope.login = function () {
  23.  
  24. $scope.Username = $scope.Username;
  25. $scope.Password = $scope.Password;
  26.  
  27. LoginCheckService.setLoginData($scope.Username, $scope.Password)
  28. .then(data => {
  29. console.log(data)
  30. })
  31.  
  32. }
  33. };
  34.  
  35. })
Add Comment
Please, Sign In to add comment