我有一个简单的多选复选框下拉列表。正如我在下面给出的。
<select name="edit_tags" class="form-control" id="advisor_article_tagsx" multiple="" required>
<option ng-repeat="service in services" value="{{service.id}}">{{service.name}}</option>
</select>
现在我希望某些复选框(例如索引 1,3,5)带有选定的复选框。
下面给出了我的 AngularJS 代码。
$scope.article_edit = function(articles) {
$scope.services = [$scope.model[0], $scope.model[1]];
}
那我需要做什么呢??
谢谢
最佳答案
为什么不在选择字段上使用具有良好支持的 ng-options 和 ng-model 。所以你的模板可以是:
<select name="edit_tags" class="form-control" id="advisor_article_tagsx" multiple=""
required ng-model="selected" ng-options="service as service.name for service in services">
</select>
关于javascript - AngularJS 多选复选框下拉列表与选定的复选框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45593200/