Topic: Update multiselect options on event

anuragd7 free asked 4 years ago


In a modal element I have a form containing 2 multi-select elements, one after the other. Whenever I select or deselect one or more options selected in the first multi-select, I need to dynamically update the available options in the second multi-select. Currently even though I am changing the array containing the options , I am not able to update the options in the second multi-select in the view.


Arkadiusz Idzikowski staff answered 4 years ago


Hello,

How do you update the options array? Please note that you need to use spread operator (or other method that will change the reference to the array), not 'push' method. Only then Angular will trigger change detection on select options.

It is described in our documentation: https://mdbootstrap.com/docs/angular/forms/multiselect/#update-options


anuragd7 free commented 4 years ago

Thanks your approach works. I had overlooked this



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: 7.5.1
  • Device: mac
  • Browser: chrome
  • OS: osx
  • Provided sample code: No
  • Provided link: No