【发布时间】:2014-03-16 11:10:29
【问题描述】:
我在我的 Angular 应用程序中使用引导多选。 (引导程序 2.3)
http://davidstutz.github.io/bootstrap-multiselect/index-2-3.html#examples
我想将相同的东西转换为引导输入,但用户仍然可以在搜索结果中多选值。
我正在使用 bootstrap typeahed 的荧光笔功能为结果添加复选框。 我指的是这个 plnkr http://plnkr.co/edit/szO2An1oslDyGftnshyR?p=preview 但我仍然无法使我的代码工作。
多选的旧代码:
-
检查最后选择的值
$scope.selectOptions = function () { var index = fetching the index of checked values; var selectedAttrFound = index>-1; if (selectedAttrFound == true) { angular.element("#attr-value-selector") .multiselect('select', $scope.filterAttributes[index].attributeValues); } }; -
填充多选
$scope.attrValuesWidget = angular.element("#attr-value-selector") .multiselect({ numberDisplayed: 2, enableFiltering: true, maxHeight: "300", onChange: function (element, checked) { $scope.attributeActionValue = { attribute: $scope.attributeSelected, value: element.val(), checked: checked }; $scope.$apply(); } }) .multiselect('dataprovider', $scope.configAttributeValuesList); -
选择框
<select id='attr-value-selector' multiple='multiple' ></select>
【问题讨论】:
标签: javascript angularjs twitter-bootstrap bootstrap-typeahead bootstrap-multiselect