84
84
}
85
85
} ;
86
86
87
+ // Update selection options if data changes
88
+ $scope . $watch ( 'options' , function ( newVal ) {
89
+ $scope . options = newVal ;
90
+ $scope . resolvedOptions = newVal ;
91
+ updateSelectionLists ( ) ;
92
+ } , true ) ;
93
+
87
94
$ngModelCtrl . $render = function ( ) {
88
95
updateSelectionLists ( ) ;
89
96
} ;
235
242
angular . module ( 'btorfs.multiselect.templates' , [ 'multiselect.html' ] ) ;
236
243
237
244
angular . module ( "multiselect.html" , [ ] ) . run ( [ "$templateCache" , function ( $templateCache ) {
238
- $templateCache . put ( "multiselect.html" ,
239
- "<div class=\"btn-group\" style=\"width: 100%\">\n" +
240
- " <button type=\"button\" class=\"btn btn-default btn-block dropdown-toggle\" ng-click=\"toggleDropdown()\" ng-disabled=\"disabled\">\n" +
241
- " {{getButtonText()}} <span class=\"caret\"></span>\n" +
242
- " </button>\n" +
243
- " <ul class=\"dropdown-menu dropdown-menu-form\"\n" +
244
- " ng-style=\"{display: open ? 'block' : 'none'}\" style=\"width: 100%; overflow-x: auto\">\n" +
245
- "\n" +
246
- " <li ng-show=\"showSelectAll\">\n" +
247
- " <a ng-click=\"selectAll()\" href=\"\">\n" +
248
- " <span class=\"glyphicon glyphicon-ok\"></span> {{labels.selectAll || 'Select All'}}\n" +
249
- " </a>\n" +
250
- " </li>\n" +
251
- " <li ng-show=\"showUnselectAll\">\n" +
252
- " <a ng-click=\"unselectAll()\" href=\"\">\n" +
253
- " <span class=\"glyphicon glyphicon-remove\"></span> {{labels.unselectAll || 'Unselect All'}}\n" +
254
- " </a>\n" +
255
- " </li>\n" +
256
- " <li ng-show=\"(showSelectAll || showUnselectAll)\"\n" +
257
- " class=\"divider\">\n" +
258
- " </li>\n" +
259
- "\n" +
260
- " <li role=\"presentation\" ng-repeat=\"option in selectedOptions\" class=\"active\">\n" +
261
- " <a class=\"item-selected\" href=\"\" title=\"{{showTooltip ? getDisplay(option) : ''}}\" ng-click=\"toggleItem(option); $event.stopPropagation()\">\n" +
262
- " <span class=\"glyphicon glyphicon-remove\"></span>\n" +
263
- " {{getDisplay(option)}}\n" +
264
- " </a>\n" +
265
- " </li>\n" +
266
- " <li ng-show=\"selectedOptions.length > 0\" class=\"divider\"></li>\n" +
267
- "\n" +
268
- " <li ng-show=\"showSearch\">\n" +
269
- " <div class=\"dropdown-header\">\n" +
270
- " <input type=\"text\" class=\"form-control input-sm\" style=\"width: 100%;\"\n" +
271
- " ng-model=\"searchFilter\" placeholder=\"{{labels.search || 'Search...'}}\" ng-change=\"updateOptions()\"/>\n" +
272
- " </div>\n" +
273
- " </li>\n" +
274
- "\n" +
275
- " <li ng-show=\"showSearch\" class=\"divider\"></li>\n" +
276
- " <li role=\"presentation\" ng-repeat=\"option in unselectedOptions | filter:search() | limitTo: searchLimit\"\n" +
277
- " ng-if=\"!isSelected(option)\"\n" +
278
- " ng-class=\"{disabled : selectionLimit && selectedOptions.length >= selectionLimit}\">\n" +
279
- " <a class=\"item-unselected\" href=\"\" title=\"{{showTooltip ? getDisplay(option) : ''}}\" ng-click=\"toggleItem(option); $event.stopPropagation()\">\n" +
280
- " {{getDisplay(option)}}\n" +
281
- " </a>\n" +
282
- " </li>\n" +
283
- "\n" +
284
- " <li class=\"divider\" ng-show=\"selectionLimit > 1\"></li>\n" +
285
- " <li role=\"presentation\" ng-show=\"selectionLimit > 1\">\n" +
286
- " <a>{{selectedOptions.length || 0}} / {{selectionLimit}} {{labels.itemsSelected || 'selected'}}</a>\n" +
287
- " </li>\n" +
288
- "\n" +
289
- " </ul>\n" +
290
- "</div>\n" +
291
- "" ) ;
292
- } ] ) ;
245
+ $templateCache . put ( "multiselect.html" ,
246
+ "<div class=\"btn-group\" style=\"width: 100%\">\n" +
247
+ " <button type=\"button\" class=\"btn btn-default btn-block dropdown-toggle\" ng-click=\"toggleDropdown()\" ng-disabled=\"disabled\">\n" +
248
+ " {{getButtonText()}} <span class=\"caret\"></span>\n" +
249
+ " </button>\n" +
250
+ " <ul class=\"dropdown-menu dropdown-menu-form\"\n" +
251
+ " ng-style=\"{display: open ? 'block' : 'none'}\" style=\"width: 100%; overflow-x: auto\">\n" +
252
+ "\n" +
253
+ " <li ng-show=\"showSelectAll\">\n" +
254
+ " <a ng-click=\"selectAll()\" href=\"\">\n" +
255
+ " <span class=\"glyphicon glyphicon-ok\"></span> {{labels.selectAll || 'Select All'}}\n" +
256
+ " </a>\n" +
257
+ " </li>\n" +
258
+ " <li ng-show=\"showUnselectAll\">\n" +
259
+ " <a ng-click=\"unselectAll()\" href=\"\">\n" +
260
+ " <span class=\"glyphicon glyphicon-remove\"></span> {{labels.unselectAll || 'Unselect All'}}\n" +
261
+ " </a>\n" +
262
+ " </li>\n" +
263
+ " <li ng-show=\"(showSelectAll || showUnselectAll)\"\n" +
264
+ " class=\"divider\">\n" +
265
+ " </li>\n" +
266
+ "\n" +
267
+ " <li role=\"presentation\" ng-repeat=\"option in selectedOptions\" class=\"active\">\n" +
268
+ " <a class=\"item-selected\" href=\"\" title=\"{{showTooltip ? getDisplay(option) : ''}}\" ng-click=\"toggleItem(option); $event.stopPropagation()\">\n" +
269
+ " <span class=\"glyphicon glyphicon-remove\"></span>\n" +
270
+ " {{getDisplay(option)}}\n" +
271
+ " </a>\n" +
272
+ " </li>\n" +
273
+ " <li ng-show=\"selectedOptions.length > 0\" class=\"divider\"></li>\n" +
274
+ "\n" +
275
+ " <li ng-show=\"showSearch\">\n" +
276
+ " <div class=\"dropdown-header\">\n" +
277
+ " <input type=\"text\" class=\"form-control input-sm\" style=\"width: 100%;\"\n" +
278
+ " ng-model=\"searchFilter\" placeholder=\"{{labels.search || 'Search...'}}\" ng-change=\"updateOptions()\"/>\n" +
279
+ " </div>\n" +
280
+ " </li>\n" +
281
+ "\n" +
282
+ " <li ng-show=\"showSearch\" class=\"divider\"></li>\n" +
283
+ " <li role=\"presentation\" ng-repeat=\"option in unselectedOptions | filter:search() | limitTo: searchLimit\"\n" +
284
+ " ng-if=\"!isSelected(option)\"\n" +
285
+ " ng-class=\"{disabled : selectionLimit && selectedOptions.length >= selectionLimit}\">\n" +
286
+ " <a class=\"item-unselected\" href=\"\" title=\"{{showTooltip ? getDisplay(option) : ''}}\" ng-click=\"toggleItem(option); $event.stopPropagation()\">\n" +
287
+ " {{getDisplay(option)}}\n" +
288
+ " </a>\n" +
289
+ " </li>\n" +
290
+ "\n" +
291
+ " <li class=\"divider\" ng-show=\"selectionLimit > 1\"></li>\n" +
292
+ " <li role=\"presentation\" ng-show=\"selectionLimit > 1\">\n" +
293
+ " <a>{{selectedOptions.length || 0}} / {{selectionLimit}} {{labels.itemsSelected || 'selected'}}</a>\n" +
294
+ " </li>\n" +
295
+ "\n" +
296
+ " </ul>\n" +
297
+ "</div>\n" +
298
+ "" ) ;
299
+ } ] ) ;
0 commit comments