-
Notifications
You must be signed in to change notification settings - Fork 331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"First" filter fails with expressions #78
Comments
Can you please provide some jsbin/fiddle example, @thisischrisj ? |
Here you go 0.4.4: http://jsfiddle.net/jg1k73xm/1/ I know I mentioned v0.4.5 but I couldn't link to the src. I checked with 0.4.6 but got the same result as 0.5.2 |
Thanks @thisischrisj, |
I can see the logic and my second example shows that reasonable workarounds exist. I would just recommend updating the documentation as this still references the ability to use expressions with first, last, etc... It probably wouldn't hurt to mention your decision on "only filter without an arguments return an object" too. This would help users understand expected return types. |
Awesome @thisischrisj, thanks! |
While 'first' seems to be fixed, the same problem seems to apply to 'last' when it's an array of objects not a simple array. Using version 0.5.17. |
Given this data:
This failed:
<div type="{{ (types | first: 'default === true').name }}"></div>
I had to revert to:
<div type="{{ ((types | where: {default:true}) | first).name }}"></div>
As a test I also did:
<div type="{{ (types | first: 1).name }}"></div>
but didn't seem to work either
This was working on 0.4.5 but not in 0.5.2
The text was updated successfully, but these errors were encountered: