isteven / angular-multi-select

A multi select dropdown directive for AngularJS. Allows you to use HTML tags and CSS in the data. Requires only AngularJS and nothing else.
isteven.github.io/angular-multi-select
MIT License
1.08k stars 518 forks source link

How to reset multi-select button without click on it? #364

Closed stl-winniechan closed 8 years ago

stl-winniechan commented 8 years ago

I'm using version 3.0. I able to integrate the angular-multi-select in my web application. However, the problem come after the request is submitted and when I reset all the settings. For angular-multi-select, I tried to reset both the input-model and output-model, however, the button text stay with the previous selections until I click on it. Is there any way to programatically reset the button?

Any help is appreciated!

isteven commented 8 years ago

@stl-winniechan ,

First, please try to get the latest version from the release page.

To directly manipulate the data, you manipulate the input-model. Not the output-model. The button should automatically update itself.

k1ngsengson commented 8 years ago

hi,

I am having the same issue. I have a button which resets all multiselect drodpdowns in a page. I have manipulated the input-model by recalling the API. It seems the reset only works if the data has been makeKeysAsIntegers()

VictorDeBlas commented 8 years ago

I've got the same problem, @k1ngsengson

Do you have a solution?

k1ngsengson commented 8 years ago

@VictorDeBlas I rebind the input-model then added this code $('.ng-binding').trigger('click');

$scope.reset = function () { $scope.InputModel = list.InputModel; $('.ng-binding').trigger('click'); }; list.InputModel is just a variable where I stored the original list to prevent calling the database or API twice. Hope this helps

VictorDeBlas commented 8 years ago

Ok! Thanks!