-
Notifications
You must be signed in to change notification settings - Fork 27.4k
filter and orderBy should also work with objects in ngRepeat #8458
Comments
This is easy to fix using a Here is a solution that uses @finalclass's toArray filter (remembering that this will not work on IE8): http://jsfiddle.net/z8ME5/ Here is a version that uses toArray but actually modifies the original object (and will work on IE8): |
And here is a version with a filter: http://jsfiddle.net/75LLk/ |
I have created a module that provides the |
I am having a problem with lack of built in It would be nice if I could sort my object values without converting it to an array. |
@mohsen1 - you can always achieve what you want by doing the ordering in a controller: watching the object, ordering it and attaching the ordered list to the scope, which you can then bind to. But regarding |
People are advocating for a |
there have been recent fixes to that problem @kvcrawford --- they will now (by default) be treated as pure and only re-run if their inputs change |
Given that this has been rejected for filterFilter in #2694, this probably should be closed as won't support since orderBy suffers the same issues. |
Yes, I agree - and we have a performance workaround. |
filter
andorderBy
should work with objects withinngRepeat
. My use case for this, I have already written recently in #1286, but the issue only refers tooderBy
and has previously been rejected seemingly because no concrete use case has been found for this.Here is my use case where I absolutely need an object instead of an array:
A support of objects in
filter
andorderBy
of AngularJS for me would be really helpful as I would otherwise have to try myself to implement such a function.The text was updated successfully, but these errors were encountered: