一开始,当加载选择时,它很好,但当我更改选项时它显示我选择一个空选项,然后它工作正常
HTML:
<select name="questionId1" class="questionId1 form-control required" tabindex="3" ng-model="abCtrl.questions.question1" ng-options="question.value as question.val for question in abCtrl.form.questions track by question.index"></select>
JS:
for(var i in $scope.getSecurityQus.questions){
self.form.questions.push({index:i-6, key:i, val:$scope.getSecurityQus.questions[i]});
}
self.questions.question1 = self.form.questions[0];
self.questions.question2 = self.form.questions[1];
第一次更改后的结果:
<option value="?" selected="selected"> </option>
<option label="question ONE" value="0" selected="selected">question ONE</option>
<option label="question TWO" value="1">question TWO</option>
<option label="question THREE" value="2">question THREE</option>
<option label="question FOUR" value="3">question FOUR</option>