如何在点击某个按钮后将输入值重置为空值?
空字段:
我想将具有某些值的字段重置回空字段。
HTML:
<label class="item item-input">
<input id="tezina" type="number" placeholder="Tezina" ng-model="podaci.tezina">
</label>
<label class="item item-input">
<input id="mamac" type="text" placeholder="Mamac" ng-model="podaci.mamac">
</label>
<label class="item item-input">
<input id="pribor" type="text" placeholder="Pribor" ng-model="podaci.pribor">
</label>+
<button class="button button-positive" ng-click="isprazniPolja()">Isprazni</button>
我试过(不工作),来自 Controller 的功能:
$scope.isprazniPolja = function() {
$scope.podaci= null;
}
最佳答案
我想你想重置值 你可以这样做
$scope.isprazniPolja = function(){
$scope.podaci.tezina="";
$scope.podaci.mamac="";
$scope.podaci.pribor="";
}
关于javascript - 将值设置为 null,或起始值 Angularjs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36078724/