bentorfs / angular-bootstrap-multiselect

Native angularJS custom form element
http://bentorfs.github.io/angular-bootstrap-multiselect/
MIT License
79 stars 111 forks source link

Found problem in code #70

Open ZhangWei88 opened 6 years ago

ZhangWei88 commented 6 years ago

Hi dear.

How are you? I have found a problem in the source code so would like to notice to you. I tried to use async data load function for multiselect but got javascript error whenever open dropdown. So I checked the source code of multiselect and found there is a problem. I think you should replace these lines :

$scope.toggleDropdown = function () {
      $scope.open = !$scope.open;
      $scope.resolvedOptions = $scope.options;
      updateSelectionLists();
};

by these lines :

$scope.toggleDropdown = function () {
      $scope.open = !$scope.open;
      if (typeof $scope.options !== 'function') {
            $scope.resolvedOptions = $scope.options;
      }
      updateSelectionLists();
};

I think this problem had been made when fix the issue #21 . I hope this report would help you even a little.

Thanks, Zhang