javascript - Angular js with jquery multi select plugin -
i using jquery plugin converts normal select dropdown fancy multi select dropdown. here's plugin url: http://wenzhixin.net.cn/p/multiple-select/
now, problem facing that, using angular js bind dropdown values. and, used angular js directives as
app.directive('ccmultipleselect', function () { var directive = { link: link, restrict: 'a' }; return directive; function link(scope, element, attrs) { element.multipleselect({ selectall: false }); } }); and in html view code below:
<select data-ng-options="c.key c.value c in vm.units" multiple="multiple" data-cc-multiple-select> </select> but, issue that, when directive event called i.e. multipleselect plugin called, time angular js didn't done binding , fancy dropdown contains no elements. 1 quick solution thought use settimeout function call plugin after 500ms , that's not ideal solution. there must other way through can watch dropdown elements , refresh elements further.
option 1 : have tried timeout without delay. had similar issue other : jquery plugin did not load dynamic data.
option 2 : redraw multiselect $('select').multipleselect();
Comments
Post a Comment