1
在AngularJS中,如何在按鈕中設置ng-disabled
屬性,以便在用戶輸入十進制輸入時不會啓用它?如何在輸入爲十進制時在AngularJS中設置ng-disabled
目前,當我輸入「0.1」但該按鈕已啓用時,該框以紅色突出顯示。
<input type="number" ng-model="person.age" id="age" name="age" placeholder="Age"
class="form-control" min="0" ng-change="compute()" ng-required="!person.age">
<button id="ok-btn" class="btn btn-primary" ng-click="okEdit(person)"
ng-disabled="(!person.age && person.age !== 0)">OK</button>
當person.age = undefind?和person.age!== 0? – Erez