Instead of filling it with content, why not utilize a placeholder?
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.pass = ""; // keeping it empty instead of "PASSWORD"
$scope.foo = () => {
console.log($scope.pass);
};
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<div ng-app="myApp" ng-controller="myCtrl">
<input placeholder="PASSWORD" ng-model="pass">
<button ng-click="foo()" ng-disabled="!pass">Sign in</button>
</div>
Here's another instance tailored to your needs. This example allows you to enter text while keeping the button disabled. It employs ng-focus
to clear the input field when selected and includes $dirty
validation for enabling the button only if modifications have been made.
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.pass = "PASSWORD";
$scope.foo = () => {
console.log($scope.pass);
};
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<div ng-app="myApp" ng-controller="myCtrl">
<form name="form">
<input ng-focus="pass=''" name="pass" ng-model="pass">
<button ng-click="foo()" ng-disabled="!form.pass.$dirty || !pass">Sign in</button>
</form>
</div>