<oi-select class="oi-select"
oi-options="student.name for student in students track by student._id"
multiple placeholder="" ng-model="class.students" ng-change="clickedName()">
</oi-select>
这是多个选择选项。我想知道oi.select的点击选项;选择和取消选择。如何以角度方式写这个?感谢。
答案 0 :(得分:0)
您可以通过访问ng-model
来获取单击的选项<oi-select class="oi-select"
oi-options="student.name for student in students track by student._id"
multiple placeholder="" ng-model="student" ng-change="clickedName()">
</oi-select>
<强> Controller:
强>
console.log($scope.student);
或者您可以通过ng-change传递所选的
<oi-select class="oi-select"
oi-options="student.name for student in students track by student._id"
multiple placeholder="" ng-model="student" ng-change="clickedName(student)">
</oi-select>
<强> Controller
强>
$scope.clickedName = function(selected){
console.log(selected.name);
}