In my AngularJS controller, I am having trouble retrieving the values of the username and password fields after submitting the login form. Here is the HTML code for the form:
<form class="form-signin" action="" method="post">
<span id="reauth-email" class="reauth-email"></span>
<input type="text" ng-model="username" id="Username" name="Username" class="form-control" placeholder="Email address" required autofocus>
<input type="password" ng-model="password" id="password" name="password" class="form-control" placeholder="Password" required style="margin-top:10px">
<div id="remember" class="checkbox">
<label>
<input type="checkbox" value="remember-me"> Remember me
</label>
</div>
<input type="hidden" name="" value="" />
<input class="btn btn-lg btn-primary btn-block btn-signin" type="button" value="{{btntext}}" ng-click="login()" >
</form>
This script uses AngularJS
var app = angular.module('homeapp', []);
app.controller('HomeController', function($scope, $http) {
$scope.username = '';
alert($scope.username);
$scope.btntext="Login";
$scope.login=function () {
$http.get("/account/loginverify")
.then(function(response) {
$scope.myWelcome = response.data;
if(response.data=="1"){
window.location.href='home.html'
}
else {
alert("Invalid username or password...!!!")
}
});
}
});