嗨我有動態添加選擇選項的表單域。我想要的是在新添加的字段中禁用先前選擇的選項。 我的HTML是這樣Angularjs動態表單域與選擇選項已禁用已選擇選項
<div ng-repeat="exam_student in exam_students track by $index">
<select
ng-model="exam_student.student_id"
options="students"
ng-options="student.id as student.sname for student in students">
</select>
<button type="button" ng-click="removeStudent($index)">-</button>
</div>
<button type="button" ng-click="addStudent()">+</button>
和我的JS是
$scope.exam_students = [{}];
$scope.addStudent = function(){
$scope.exam_students.push({});
}
$scope.removeStudent = function(index){
$scope.exam_students.splice(index,1);
}
這裏是Plunker plnkr.co/edit/VOZrqIos54IcunBTAwat
感謝您的任何幫助和建議。
代碼上plunker請 –
請檢查https://開頭plnkr。 co/edit/VOZrqIos54IcunBTAwat – sanu
請清楚你的要求是什麼 –