Switch to another view if login success in mvc4 angularJS

May 20 2018 2:58 AM
1. Part3Controller.js is Javascript Controller.
2.Now I want to open Employee list after successful login. Instead of the line of code:$scope.Message = "Successfully login done. Welcome " + d.data.FullName; 
 
 
 
 
.controller('Part3Controller', function ($scope,LoginService) {
$scope.IsLogedIn = false;
$scope.Message = '';
$scope.Submitted = false;
$scope.IsFormValid = false
$scope.LoginData = {
Username:'',
Password:''
};
//Check is form valid or not // here f1 is our form name
$scope.$watch('f1.$valid', function (newVal) {
$scope.IsFormValid = newVal;
});
$scope.Login = function () {
$scope.Submitted = true;
if ($scope.IsFormValid) {
LoginService.GetUser($scope.LoginData).then(function (d) {
if (d.data.Username != null) {
$scope.IsLogedIn = true;
$scope.Message = "Successfully login done. Welcome " + d.data.FullName;
}
else {
alert('Invalid Credential');
}
});
}
};
})
.factory('LoginService', function ($http) {
var fac = {};
fac.GetUser = function (d) {
return $http({
url: '/Data/UserLogin',
method: 'POST',
data: JSON.stringify(d),
header: { 'content-type': 'application/json' }
});
};
return fac;
});
 
 
3. If someone has solution help me. Thank you.