angular-select2 icon indicating copy to clipboard operation
angular-select2 copied to clipboard

ng-options with "orderBy" Error: [$rootScope:infdig]

Open benjamin-mueller opened this issue 10 years ago • 6 comments

Hi,

when I try something like

<select2 ng-model="form.channel"
             multiple
             data-allow-clear="true"
             data-placeholder="Channel"
             class="form-control input-sm"
             ng-options="channel._id as channel.name for channel in theChannels | orderBy:'name'">
    </select2>

the dropdown list gets sorted by "name" but in the Console I get multiple

http://errors.angularjs.org/1.3.8/$rootScope/infdig?p0=10

What am I doing wrong?

Thanks for the help

Benjamin

benjamin-mueller avatar Jan 13 '15 16:01 benjamin-mueller

This is an Angular bug. Same reason why you can't have filter in there.

I wish there was a way on how to support this (a scope variable to a directive with a filter inside), but I haven't found it yet.

So sadly, you're not doing anything wrong. It just doesn't work right now. I really want to be able to support this, but I haven't found a way to fix it yet.

rubenv avatar Jan 13 '15 17:01 rubenv

Thanks for the super fast feedback!

I just seems that none of the angular select / select2 directives seem to work 100% which is a real dealbreaker for a production environment.

Anyways, yours is still the most versatile and stable, and since there is always Array.sort() I am very thankful your directive works the way ist does, stable!

Regards

Benjamin

benjamin-mueller avatar Jan 14 '15 09:01 benjamin-mueller

which is a real dealbreaker for a production environment.

Nah, we're using it in production without any issues. It's just a set of limitations you have to be aware of.

rubenv avatar Jan 14 '15 09:01 rubenv

We are too .. but have a look at ui-select2 or ui-select .. they are broken in so many ways .. yours isnt .. :)

benjamin-mueller avatar Jan 14 '15 09:01 benjamin-mueller

Hi, Does this mean that we can not use any filters with ng-options?

PS: I also think that your component is the best fit for our production environment.

yppeaxy avatar Mar 24 '15 16:03 yppeaxy

Just build your own filter, it will work.

CrackerakiUA avatar Aug 01 '15 20:08 CrackerakiUA