I'm currently implementing bootstrap multiselect in my angular project (Bootstrap 2.3)
My goal is to achieve a similar functionality using bootstrap typeahead, allowing users to select multiple values from search results.
I've tried using the highlighter function of bootstrap typeahed to incorporate checkboxes into the results. I found inspiration from this plnkr http://plnkr.co/edit/szO2An1oslDyGftnshyR?p=preview, but I'm still struggling to get my code to work.
Original Code for multiselect:
To check previously selected values
$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); } };
To populate the multiselect
$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);
The Select box
<select id='attr-value-selector' multiple='multiple' ></select>