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

ui-select doesn't show select-choices in modal window from $scope array of objects

Open Exiliot opened this issue 11 years ago • 14 comments

I faced with such problem: ui-select doesn't work normally in Angular-Bootstrap modal window if the array of objects for select-choices is defined directly in the modal controller. If the array is returned by $http request - ui-select works good. Why is it so?

Exiliot avatar Jul 22 '15 07:07 Exiliot

i have the same problem.

lugithub avatar Jul 31 '15 16:07 lugithub

Can you setup a plunker?

dimirc avatar Aug 01 '15 00:08 dimirc

I can confirm this bug too.

krtek avatar Aug 07 '15 00:08 krtek

+1

jbonigomes avatar Aug 11 '15 14:08 jbonigomes

I know this is a hack, but @DeezCashews temporary solution is working for me:

https://github.com/angular-ui/ui-select/issues/1126

jbonigomes avatar Aug 11 '15 14:08 jbonigomes

@jbonigomes Thanks! This workaround works.

krtek avatar Aug 11 '15 14:08 krtek

Great stuff @krtek

jbonigomes avatar Aug 11 '15 14:08 jbonigomes

Glad it could help. If you get a chance please upvote at http://stackoverflow.com/questions/29893423/angular-ui-select-is-not-displaying-the-list-of-options-when-included-in-angular/31886971#31886971 so others can find solution easier on SO.

DeezCashews avatar Aug 11 '15 16:08 DeezCashews

yes @DeezCashews, will do

jbonigomes avatar Aug 11 '15 16:08 jbonigomes

Error occurs here in select.js: (line 610: ctrl.searchInput.css('width', '10px');)

In this case input tag has width: 10px. You can click in this 10px-area - and it will work. As we use this lib via bower - I've fix it without touching source in the following way:

{{::$item.name}} so, if model array is empty - just make width of input 100%. We use 'select2' theme

.empty.ui-select-match + .select2-search-field, .empty.ui-select-match + .select2-search-field input{ width: 100% !important; }

captify-ddavydov avatar Aug 14 '15 11:08 captify-ddavydov

thanks @captify-ddavydov this also works for me

jbonigomes avatar Aug 14 '15 12:08 jbonigomes

Closing due to lack of reproduction in Plunker - feel free to open a new issue if this is still a problem with reproduction.

wesleycho avatar Mar 27 '16 23:03 wesleycho

Met this problem too, all the above solutions didn't work for me. I fixed it by replace the isNil function in select.js with: function isNil(value) { return angular.isUndefined(value) || value === null || !Object.keys(value).length; }

vylan avatar Oct 19 '17 14:10 vylan

I also met this problem while using ui-modal and I solve this using 'ng-class' condition to the ui-select-choices directive:

modal.html

<ui-select ng-model="person.selected" theme="bootstrap" on-select="onSelect($item)" ng-click="select_open = true">
    <ui-select-match placeholder="制作者">{{$select.selected.name}}</ui-select-match>
    <ui-select-choices repeat="item in people | propsFilter: {name: $select.search, email: $select.search}" ng-class="{ 'select_open': select_open }">
        <div ng-bind-html="item.name | highlight: $select.search"></div>
        <small ng-bind-html="item.email | highlight: $select.search"></small>
    </ui-select-choices>
    <ui-select-no-choice>
        一致するものは見つかりませんでした。
    </ui-select-no-choice>
</ui-select>

app.js

$scope.onSelect = function(item) {
    $scope.open_select = false;
	}

style.css

.select_open {
	opacity: 1 !important;
}

Hope it helps. 👍

ghost avatar Mar 09 '18 03:03 ghost