Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var LoginCheckService = angular.module('LoginCheckService', []);
- LoginCheckService.service('LoginCheckService', function($http, $q) {
- var LoginData = {
- Username: '',
- Password: ''
- }
- this.setLoginData = function(UName, Pass){
- return $q(resolve, reject -> {
- LoginData.Username= UName;
- LoginData.Password = Pass;
- resolve('Success')
- })
- }
- });
- var loginApp = angular.module('loginApp', ['LoginCheckService']);
- loginApp.controller('MainCtrl', function ($scope, $http, $window, LoginCheckService) {
- $scope.login = function () {
- $scope.Username = $scope.Username;
- $scope.Password = $scope.Password;
- LoginCheckService.setLoginData($scope.Username, $scope.Password)
- .then(data => {
- console.log(data)
- })
- }
- };
- })
Add Comment
Please, Sign In to add comment