3

I'm new in angularjs and trying to solve the problem. My question is how to make single select from ng-dropdown-multiselect I found some of the solutions like:

vm.dropDownAreaSelection = {
      selectionLimit: '1',
      closeOnSelect: true,
      displayProp: 'name',
      idProp : 'name',
      showCheckAll : false,
      showUncheckAll : false,
      onChange: vm.filterChangedSelection,
      smartButtonMaxItems: 1,
    };

<div ng-dropdown-multiselect
     options="vm.selectArea"
     selected-model="vm.selected.areaObj"
     extra-settings="vm.dropDownAreaSelection"></div>

it's working fine but when I select one item previously selected is not unselected. I'm using angularjs 1.5.3

Any help will be appreciated.

Thanks in advance

3
  • ng-dropdown-multiselect fires many event on selection. may be you can clear the model manually. Commented Aug 8, 2017 at 9:31
  • Why do you need ng-dropdown-multiselect at all if you only intend to select 1 item? Commented Aug 8, 2017 at 10:41
  • Actually it's a big filter already made for ng-dropdown-multiselect, I tried to make select / option code crashed. So I need to fix existing structure. Commented Aug 8, 2017 at 10:50

1 Answer 1

2

Make sure that selected-model is not an array. It should be object.

vm.selected.areaObj = {};

For more than 1 selection limit, it should be array.

vm.selected.areaObj = [];
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.