I'm new to angularjs, I'm bit confused about Login Process.
Everytime I log in I'm redirected to the specific page. Which is set already in the code.
I just want to check if the user is logged in. If yes then redirect to --Home-- if not logged in redirect to --Login Again--
What should I use for this?
I heard about local storage. SessionStorage, I'm not familiar with them. Tell me which way I can manage Login?
Here is my controller for Login
app.controller('AngularLoginController', ['$scope', '$http', function($scope, $http) {
$scope.loginForm = function() {
$http.post("login.php", {
'email' :$scope.inputData.email,
'password':$scope.inputData.password
}).success(function(data) {
console.log(data);
if ( data == 'correct') {
window.location.href = 'welcome_dashboard.php';
}
else {
$scope.errorMsg = "Invalid Email and Password";
}
})
}
}]);