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

Cannot create property '_uiSelectChoiceDisabled' on ... #1661

Closed
nehalist opened this issue Jun 14, 2016 · 17 comments
Closed

Cannot create property '_uiSelectChoiceDisabled' on ... #1661

nehalist opened this issue Jun 14, 2016 · 17 comments

Comments

@nehalist
Copy link

nehalist commented Jun 14, 2016

Bug description:

<ui-select multiple tagging tagging-label="(custom 'new' label)" ng-model="ctrl.multipleDemo.colors" theme="bootstrap" sortable="true" ng-disabled="ctrl.disabled" style="width: 300px;" title="Choose a color">
        <ui-select-match placeholder="Select colors...">{{$item}}</ui-select-match>
        <ui-select-choices repeat="color in availableColors | filter:$select.search">
          {{color}}
        </ui-select-choices>
      </ui-select>

Directly copied from the plunker example triggers "Cannot create property '_uiSelectChoiceDisabled' on string 'blue'" (respectively for all other colors in my array).

Additionally: the demo (http://angular-ui.github.io/ui-select/demo-tagging.html) triggers "Cannot read property 'length' of undefined" if you remove the existent tags.

Link to minimally-working plunker that reproduces the issue:

Works fine in Plunker. I have no idea why.

Version of Angular, UI-Select, and Bootstrap/Select2/Selectize CSS

Angular: 1.4.10

UI-Select: 0.18.0

Bootstrap/Select2/Selectize CSS (if applicable): ~3.3.6

@peterreisz
Copy link

I have a similar issue:

Update the tagging example version to 0.18.0 and click inside the first ui-select.
The following error shows up in the javascript console for every item:

TypeError: Cannot create property '_uiSelectChoiceDisabled' on string 'Green'
    at ctrl.isDisabled (select.js:603)
    at Array.fn1 (eval at <anonymous> (angular.js:14086), <anonymous>:4:1163)
    at expressionInputsWatch (angular.js:15136)
    at Scope.$digest (angular.js:16655)
    at Scope.$apply (angular.js:16928)
    at HTMLInputElement.<anonymous> (angular.js:24551)
    at defaultHandlerWrapper (angular.js:3398)
    at HTMLInputElement.eventHandler (angular.js:3386)

plunkr: http://plnkr.co/edit/SsCE6gnNQeSOtBx0lNld?p=preview

Versions:
angular: 1.5.0
ui-select: 0.18.0
bootstrap: 3.1.1

@rszczypka
Copy link

Reporting the same issue:
Angular 1.5.6
ui-select 0.18.0

@peterreisz
Copy link

Connected problem: ui-select modifies the data structure of the item, and it can travels back to the server. We have very strict server side validation and unknown properties are not allowed, so upgrading to version v0.18.0 broke several functions of our application.
It would be good to store the additional properties of the item somewhere else.

@mcantrell
Copy link

also encountered the issue with:

"angular": "~1.4.12",
"ui-select": "angular-ui-select#~0.18.0"

downgrading to 0.17.1 fixed the issue.

@felipsant
Copy link

Same problem here. Thanks mcantrell for the tip.

@druxax
Copy link

druxax commented Jun 25, 2016

0.17.1 - haven't this problem, but please fix 0.18+

@that1guy
Copy link

This issue still reproduces with 0.17.1 for me. See plunker here:

http://plnkr.co/edit/p4AYyEJ8XVmAjvVddx6l?p=preview

@r-navarro
Copy link

Ui-select loop over object in 0.18.0.

<ui-select-choices repeat="item in items"
where items is something like :
var items=[];
..loop ..
items.push({key:value})

Then to have a nice display don't forget to print only the value :

<div data-ng-bind-html="item.key | highlight: $select.search"></div>

Tips to send only the selected value and not the whole JS object you can do something like this :

<ui-select-choices
repeat="item.key as value in items | filter: $select.search track by $index"
..others attributes..>
<div data-ng-bind-html="value.key | highlight: $select.search"></div>
</ui-select-choices>

@NateJBeck
Copy link

Reporting same issue with: angular 1.4 + ui-select 0.18.0
Downgrading to 0.17.1 did not work for me

Console error occurs when selecting an element from the tag dropdown

@that1guy
Copy link

I've finally downgraded to 0.16.1 and everything is working as expected.

@jukkasi
Copy link

jukkasi commented Jun 30, 2016

+1

Angular 1.5.7 & ui-select 0.18.0

<ui-select multiple ng-model="ctrl.form.languages" theme="bootstrap">
    <ui-select-match placeholder="Valitse kielet...">{{'language.' + $item | translate}}</ui-select-match>
    <ui-select-choices repeat="lng in ctrl.availableLanguages">
        <div ng-bind-html="'language.' + lng | translate"></div>
    </ui-select-choices>
</ui-select>

Probably caused by change on

3ad084f#commitcomment-18076646

jukkasi referenced this issue Jun 30, 2016
…selects

Implement remove-selected="false" for multiple selects. This will disable a choice
in the dropdown of a multiple-select element instead of removing it.
@yobre
Copy link

yobre commented Jul 8, 2016

+1

user378230 added a commit to user378230/ui-select that referenced this issue Jul 8, 2016
Previously the item from the list was modified with the
_uiSelectChoiceDisabled property. This allowed a leakage of information
from ui-select to outside the directive. It also caused issues when the
was used outside of the directive.

This commit adds a reference array to store disabled items and so
prevents the need to modify the item in place.

Closes angular-ui#1200 and angular-ui#1661

Partially supersedes angular-ui#1641
@rdrscan
Copy link

rdrscan commented Jul 8, 2016

+1
Angular 1.5.5
ui-select 0.18.0

user378230 added a commit to user378230/ui-select that referenced this issue Jul 9, 2016
Previously the item from the list was modified with the
_uiSelectChoiceDisabled property. This allowed a leakage of information
from ui-select to outside the directive. It also caused issues when the
was used outside of the directive.

This commit adds a reference array to store disabled items and so
prevents the need to modify the item in place.

Closes angular-ui#1200 and angular-ui#1661

Partially supersedes angular-ui#1641
@user378230
Copy link
Contributor

Fixed by #1712

@nehalist
Copy link
Author

@user378230 bug still exists in v0.18.1.

<ui-select multiple tagging tagging-label="(custom 'new' label)" ng-model="ctrl.multipleDemo.colors" theme="bootstrap" sortable="true" style="width: 300px;" title="Choose a color">
        <ui-select-match placeholder="Select colors...">{{$item}}</ui-select-match>
        <ui-select-choices repeat="color in ['red', 'blue'] | filter:$select.search">
          {{color}}
        </ui-select-choices>
      </ui-select>

Still triggers Cannot create property '_uiSelectChoiceDisabled' on string 'red (or any other color).

@user378230
Copy link
Contributor

Impossible, the word _uiSelectChoiceDisabled doesn't exist in select.js any more in select.js 😉 (Check for yourself)

Please test more thoroughly before posting in issues. Thanks! 👍

@nehalist
Copy link
Author

nehalist commented Jul 10, 2016

Indeed, my bower update went wrong and I was still using a previous version. My bad, sorry.

Everything works fine now. Thanks!

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