Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- myApp.controller('login', ['$scope','$rootScope', '$location', '$window', 'authenticate', '$http', '$cookieStore',function($scope, $rootScope, $location, $window, authenticate, $http, $cookieStore) {
- $scope.alert = '';
- $scope.login = function(){
- authenticate.login($scope.login.username, $scope.login.password).then(function(response){
- alert("Inside controller"+JSON.stringify(response));
- });
- }
- }]);
- myApp.factory('authenticate',['$http', '$filter', '$cookieStore', '$rootScope', '$window', '$q',
- function($http, $filter, $cookieStore, $rootScope, $window, $q) {
- var data = "";
- var deferred = $q.defer();
- return {
- login: function(userName,password){
- $http.post('user/serverside/authentication.php',{username: userName, password: password})
- .then(function(response){
- deferred.resolve(response.data);
- alert("FACTORY"+JSON.stringify(response));
- });
- return deferred.promise;
- }
- }
- }]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement