【发布时间】:2015-11-29 16:04:32
【问题描述】:
我已将 ng-model 附加到 ,但如果未触摸它,我想显示默认占位符值 ($pristine)。有什么好的方法吗?我不能在初始时简单地将我的 ng-model 值设置为 null。
这是我的笨蛋:
http://plnkr.co/edit/0kzKrwKTbJzsMGG8D1gQ?p=preview
<body ng-controller="inputController">
<input type="number" id="pricefield" min="0" name="price" placeholder="Price" ng-model="test.value" required/>
</body>
angular.module('plunker', []);
function inputController($scope) {
$scope.test = {value: 0};
}
【问题讨论】:
标签: angularjs forms validation input angularjs-forms