angular-select2
angular-select2 copied to clipboard
ng-options with "orderBy" Error: [$rootScope:infdig]
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
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.
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
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.
We are too .. but have a look at ui-select2 or ui-select .. they are broken in so many ways .. yours isnt .. :)
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.
Just build your own filter, it will work.