Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

bug in multiple select? #1686

Closed
jc-vogel opened this issue Jun 24, 2016 · 1 comment
Closed

bug in multiple select? #1686

jc-vogel opened this issue Jun 24, 2016 · 1 comment

Comments

@jc-vogel
Copy link

When using multiple select, I get an error about an undefined property: $select.selected.
when rendering ui-select (multiple) the $select.selected is reset.
I think the line '$select.selected = ngModel.$viewValue;' should come before the if-statement. Otherwise, if it's not an array, it will be fixed, and immediately overwritten with the wrong or undefined data. Or am I missing something?

select.js, line 1546:

ngModel.$render = function() {

        // Make sure that model value is array

        if(!angular.isArray(ngModel.$viewValue)){

          // Have tolerance for null or undefined values

          if(angular.isUndefined(ngModel.$viewValue) || ngModel.$viewValue === null){

            $select.selected = [];

          } else {

            throw uiSelectMinErr('multiarr', "Expected model value to be array but got '{0}'", ngModel.$viewValue);

          }

        }

        $select.selected = ngModel.$viewValue;

        $selectMultiple.refreshComponent();

        scope.$evalAsync(); //To force $digest
      };
jc-vogel added a commit to jc-vogel/ui-select that referenced this issue Jun 24, 2016
user378230 added a commit to user378230/ui-select that referenced this issue Jul 7, 2016
user378230 added a commit to user378230/ui-select that referenced this issue Jul 7, 2016
Previously view value was checked and corrected if undefined, but then
overwritten with the invalid value again.

This is a minor commit to ensure the updated value isn't overwritten
again.

Originally authored by homerjam

Closes angular-ui#967 and angular-ui#1686
Supersedes angular-ui#1035 angular-ui#1529 angular-ui#1687
user378230 added a commit that referenced this issue Jul 7, 2016
Previously view value was checked and corrected if undefined, but then
overwritten with the invalid value again.

This is a minor commit to ensure the updated value isn't overwritten
again.

Originally authored by homerjam

Closes #967 and #1686
Supersedes #1035 #1529 #1687
@user378230
Copy link
Contributor

Should be resolved by #1709 closing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants