javascript - Login in asp.net using rest api and angularjs -
i have created login page in asp.net using angularjs , rest api, don't know how created?
how perform login operation in asp.net using angularjs , rest api auto-generate token.
design form below
<div class="form-box" id="login-box"> <div class="header">sign in</div> <form> <div class="body bg-gray"> <div class="form-group"> <input type="text" name="userid" ng-model="login.user_user" class="form-control" placeholder="user id"/> </div> <div class="form-group"> <input type="password" name="password" ng-model="login.user_pass" class="form-control" placeholder="password"/> </div> <div class="form-group"> <input type="checkbox" name="remember_me"/> remember me </div> </div> <div class="footer"> <button type="submit" class="btn bg-olive btn-block" ng-click="dologin(login)">sign me in</button> </div> </form> </div>
and in controller
//controller login app.controller('login', function ($scope) { //initially set objects null avoid undefined error $scope.dologin = {}; logdata = {}; $scope.dologin = function (logdata) { $http.post('urltopost').then(function(result){ if(result.data.flag==1) { window.location = "home.html"; } else { alert('wrong username , password!'); } }); }; });
Comments
Post a Comment