当下拉菜单中未选择任何内容时,应禁用该按钮。我怎样才能做到这一点?
<select size='1' id="action" ng-model="ak.action">
<option value='1'>RED</option>
<option value='2'>BLUE</option>
</select>
<div>
<button type="button" ng-Click="ak.save()" >SAVE</button>
</div>
当下拉菜单中未选择任何内容时,应禁用该按钮。我怎样才能做到这一点?
<select size='1' id="action" ng-model="ak.action">
<option value='1'>RED</option>
<option value='2'>BLUE</option>
</select>
<div>
<button type="button" ng-Click="ak.save()" >SAVE</button>
</div>
尝试ng-disabled="!ak.action || ak.action.length == 0"
在按钮上使用。尽管select
在您的情况下将始终有一个选定的项目......
<select size='1' id="action" ng-model="ak.action">
<option value='1'>RED</option>
<option value='2'>BLUE</option>
</select>
<div>
<button ng-disabled="!ak.action || ak.action.length == 0" type="button" ng-click="ak.save()" >SAVE</button>
</div>