I am trying to implement a jQuery multiselect plugin using a directive inside my application. Here is the selection item:
<select multiple
ng-model="data.partyIds"
ng-options="party.id as party.name for party in parties"
xs-multiselect="parties">
</select>
The model model is partiesloaded via $ http. The multiselect plugin analyzes elements optioninside selectand generates a nice multi-selection.
Is there a way to detect when an element is selectfilled with parameters, so I can tell the multi-selection plan to update its data?
Here is my directive:
machineXs.directive("xsMultiselect", function() {
return {
restrict: "A",
require: '?ngModel',
link: function(scope, element, attrs, ngModel) {
element.multiselect().multiselectfilter();
scope.$watch(scope[attrs["xsMultiselect"]], function() {
element.multiselect('refresh');
element.multiselectfilter("updateCache");
});
}
}
});
source
share