You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
I can sort by label, value or sort attributes. But it fails when using "sort value".
I guess it's easier to review using a jsfiddle link with an example, here it is: http://jsfiddle.net/qWzTb/733/
The text was updated successfully, but these errors were encountered:
@Loksly I believe it works as designed. When you supply an argument to the orderBy filter it is interpreted as an expression that will be evaluated in the context of a given object. Then the result of this evaluation will be used in the sort comparison. So, the important thing to note here that orderBy argument is an expression and not a field name. It might be confusing since in many cases an expression that is field name will evaluate to field value value, but this is not always the case.
If you want to supply a field name to be used in comparison you can do this by providing a constant expression. In your case it would be value: '"sort value"', a working fiddle: http://jsfiddle.net/stdg8ugy/
So while it works as expected I can see that AngularJS doc is not mentioning this constant expression = field name trick, thus it might be confusing. I'm going to send PR with the docs update later today, unless there is someone doing this before me.
Hi everybody.
I get an "Error: [$parse:syntax] Syntax Error" when using a field that has two or more words.
For example for this array of objects:
I can sort by label, value or sort attributes. But it fails when using "sort value".
I guess it's easier to review using a jsfiddle link with an example, here it is:
http://jsfiddle.net/qWzTb/733/
The text was updated successfully, but these errors were encountered: