我有一个非常基本的例子。基于JSON,我需要在select上选择正确的值,然后选中/不选中复选框。
我正在使用ng-model,但无法正常工作。你能帮我吗?
var vm = this;
vm.ticket = {"FUTURE_CALL":1,"TICKET_PRIORITY_DESCRIPTION":"Normal"}
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<select id="priority-select" uib-tooltip="Select a Priority" ng-model="vm.ticket.TICKET_PRIORITY_CODE" required="" class="ng-pristine ng-invalid ng-invalid-required ng-touched" style="">
<option value="" disabled="">--- Please select a priority ---</option>
<!-- not selected / blank option -->
<!-- ngRepeat: priority in vm.priorities -->
<option ng-repeat="priority in vm.priorities" value="L" class="ng-binding ng-scope" style="">
Low
</option>
<!-- end ngRepeat: priority in vm.priorities -->
<option ng-repeat="priority in vm.priorities" value="N" class="ng-binding ng-scope">
Normal
</option>
<!-- end ngRepeat: priority in vm.priorities -->
<option ng-repeat="priority in vm.priorities" value="H" class="ng-binding ng-scope">
High
</option>
<!-- end ngRepeat: priority in vm.priorities -->
<option ng-repeat="priority in vm.priorities" value="U" class="ng-binding ng-scope">
Unknown
</option>
<!-- end ngRepeat: priority in vm.priorities -->
</select>
<input type="checkbox" ng-model="vm.ticket.FUTURE_CALL" />