Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit f5888fb

Browse files
cauldaaronroberson
authored andcommitted
feat(limit): Change multi-select limit attr (#1632)
attr.limit should be an observable property so that it is updatable after initialization
1 parent faaca57 commit f5888fb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Diff for: src/uiSelectDirective.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ uis.directive('uiSelect',
6060
$select.onSelectCallback = $parse(attrs.onSelect);
6161
$select.onRemoveCallback = $parse(attrs.onRemove);
6262

63-
//Limit the number of selections allowed
64-
$select.limit = (angular.isDefined(attrs.limit)) ? parseInt(attrs.limit, 10) : undefined;
65-
6663
//Set reference to ngModel from uiSelectCtrl
6764
$select.ngModel = ngModel;
6865

@@ -86,6 +83,11 @@ uis.directive('uiSelect',
8683
var sortable = scope.$eval(attrs.sortable);
8784
$select.sortable = sortable !== undefined ? sortable : uiSelectConfig.sortable;
8885
});
86+
87+
attrs.$observe('limit', function() {
88+
//Limit the number of selections allowed
89+
$select.limit = (angular.isDefined(attrs.limit)) ? parseInt(attrs.limit, 10) : undefined;
90+
});
8991

9092
scope.$watch('removeSelected', function() {
9193
var removeSelected = scope.$eval(attrs.removeSelected);

0 commit comments

Comments
 (0)