嗨我有动态添加选择选项的表单域。我想要的是在新添加的字段中禁用先前选择的选项。 我的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
请清楚你的要求是什么 –