TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Dharmendra Kumar Pandit
797
918
10.1k
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.
Reply
Answers (
0
)
Need to create a page to map excel columns
Double back slashes inserted on receiving JSON(HttpClient)