html:
username: <input type="text" ng-model="username" /><br />
password: <input type="text" ng-model="password" /><br />
<button class="btn btn-primary" type="button" ng-click="login()">Login</button>
js:
$scope.login = function(){
var user = $scope.username;
var pass = $scope.password;
if(user != undefined && pass != undefined){
alert("NOT BLANK" + " user: " + user + " pass: " + pass);
} else {
alert("BLANK");
}
};
Question: When I click Login for the first time with input values from the 2 fields, alert is showing NOT BLANK user: test pass: value, but when I remove the values from the fields and click Login, alert shows NOT BLANK user: pass: which is not correct since the fields values have been removed. If I refresh the page, and click Login, alert will show BLANK. I think it is issue with cache. can someone help. I am novice with angularjs