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

$select.selected is undefined #487

Closed
ShaneZhengNZ opened this issue Dec 9, 2014 · 8 comments
Closed

$select.selected is undefined #487

ShaneZhengNZ opened this issue Dec 9, 2014 · 8 comments

Comments

@ShaneZhengNZ
Copy link

I am trying to use ui-select to render my multi-select dropdown list.

I followed the multi-select example, which works except that I see the $select.selected is undefined error message. The error does not prevent the directive from functioning, but it is quite annoy.

I debugged the code and notice that in ui.select directive, ngModel.$render function, if I do

if (ngModel.$viewValue)
    $select.selected = ngModel.$viewValue;

I won't see the error any more, but the multi-select won't work when I click on the input box, I get ctrl.items is undefined.

It seems that the ngModel.$viewValue is not defined for some reason. Is that a bug or something that I am doing correctly?

@olegweb
Copy link

olegweb commented Dec 9, 2014

Try $item not $select.selected

@ShaneZhengNZ
Copy link
Author

I did use $item

<ui-select multiple data-ng-model="stateIDs" data-ng-disabled="disabled">
    <ui-select-match placeholder="Choose a state">{{$item.name}}</ui-select-match>
    <ui-select-choices data-repeat="state.id as state in availableStates">
        {{state.name}}
    </ui-select-choices>
</ui-select>

@olegweb
Copy link

olegweb commented Dec 10, 2014

data-repeat ??

@ShaneZhengNZ
Copy link
Author

Changed data-repeat to repeat, same problem.

@olegweb
Copy link

olegweb commented Dec 10, 2014

Show your example in plnkr.co

@kitemao
Copy link

kitemao commented Dec 12, 2014

i have the same problem

@ShaneZhengNZ
Copy link
Author

I can reproduce with a demo on plnkr.co. More detailed description will be available in a new issue.

@ShaneZhengNZ
Copy link
Author

new issue - #587

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

3 participants