I am using angular to create a login form. The html is as follows:
<div class="container" ng-controller="loginCtrl">
<div class="card card-container" >
<img id="profile-img" class="profile-img-card" src="//ssl.gstatic.com/accounts/ui/avatar_2x.png" />
<p id="profile-name" class="profile-name-card"></p>
<form class="form-signin" ng-submit="authenticate()">
<input type="text" id="username" class="form-control" ng-model="username" placeholder="username" required autofocus>
<input type="password" id="password" class="form-control" ng-model="password" placeholder="password" required>
<button class="btn btn-lg btn-primary btn-block btn-signin" type="submit">Sign in</button>
</form>
</div>
</div>
My controller in angular:
ristoreApp.controller("loginCtrl",
['$scope', '$location', 'loginFactory',
function($scope, $location, loginFactory){
$scope.username = '';
$scope.password = '';
$scope.authenticate = function() {
loginFactory.login($scope.username, $scope.password)
.then(function(response) {
loginFactory.setCredentials($scope.username, $scope.password);
$location.path('/home');
}, function errorCallBack(response) {
console.log("Failed auth");
$location.path('/login');
});
}
}]);
The page remembers the username/password and shows them in the form even if I clear cache and hard reload. How do I clear the form every time I refresh the page?