dotansimha / angularjs-dropdown-multiselect

AngularJS Dropdown Multiselect
http://dotansimha.github.io/angularjs-dropdown-multiselect/
MIT License
441 stars 456 forks source link

Selecting another value #454

Open eugenevk opened 6 years ago

eugenevk commented 6 years ago

Hello, I have set selectionLimit to 1. If I have selected a value and then want to select another value, I first have to unselect the value currently chosen. Can this be done automatically by selecting another value from the list? It would prevent the user has to do an additional click.

zatchgordon commented 6 years ago

For anybody who sees this I ended up setting selectionLimit to 2 and then adding the event onMaxSelectionReached where I set whatever model I have to the second selected option. e.g. html: (simplified for purpose of example) <div ng-dropdown-multiselect="" selected-model="vm.coolio" events="vm.multiEvents"></div> controller: vm.multiEvents = {onMaxSelectionReached: function(){ vm.coolio = [vm.coolio[1]] } };