i have a login page which evaluates username and password using angularjs but it seems that my conditional statement in the controller returns false even if i put a true value
here's my html file
<div class="row">
<form action="/">
<input type="text" class="form-control" id="username" ng-model="username" required>
<input type="Password" class="form-control" id="username" ng-model="password" required>
<br>
<button type="button" style="width: 40%;" ng-click="submit()"> Log In </button>
</form>
</div>
and my controller
var app = angular.module('myApp', ["ngRoute"]);
app.controller('ctrl',
function($scope, $location) {
$scope.submit = function() {
var username = $scope.username;
var password = $scope.password;
if($scope.username == 'admin' && $scope.password == 'admin') {
console.debug('success');
} else {
console.debug('fail');
}
}
});
every time i input 'admin' in username and password i always get 'fail' in my console which means the submit function returns false . .
<input type="Password" class="form-control" id="username" ng-model="password"is that right? should the id not bepassword?