ui-select icon indicating copy to clipboard operation
ui-select copied to clipboard

$select.selected is undefined

Open ShaneZhengNZ opened this issue 11 years ago • 8 comments

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?

ShaneZhengNZ avatar Dec 09 '14 03:12 ShaneZhengNZ

Try $item not $select.selected

olegweb avatar Dec 09 '14 13:12 olegweb

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>

ShaneZhengNZ avatar Dec 09 '14 21:12 ShaneZhengNZ

data-repeat ??

olegweb avatar Dec 10 '14 05:12 olegweb

Changed data-repeat to repeat, same problem.

ShaneZhengNZ avatar Dec 10 '14 08:12 ShaneZhengNZ

Show your example in plnkr.co

olegweb avatar Dec 10 '14 16:12 olegweb

i have the same problem

kitemao avatar Dec 12 '14 08:12 kitemao

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

ShaneZhengNZ avatar Jan 14 '15 23:01 ShaneZhengNZ

new issue - https://github.com/angular-ui/ui-select/issues/587

ShaneZhengNZ avatar Jan 14 '15 23:01 ShaneZhengNZ