Skip to content
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

subscribe to root collection changes not work #3

Closed
mogadanez opened this issue Mar 3, 2014 · 3 comments
Closed

subscribe to root collection changes not work #3

mogadanez opened this issue Mar 3, 2014 · 3 comments

Comments

@mogadanez
Copy link

<li data-each="someCollection">
</li>
rivets.bind( el, { someCollection:someCollection })
someCollection.add( new Item() )

element not appears.

@azproduction
Copy link
Owner

Hello,

This is rivets's binder 'data-each' issue(It wants an Array as each argument and tries to iterate collection as array). It is impossible to fix with adapter now. Here is an Issue. This will be fixed in future version of rivets.

Right now there is 2 ways to fix it:

  • cast collection to Array, using simple filter
<li data-each="someCollection | toArray"></li>
  • wrap collection with fake model (better one), adapter can handle this
<li data-each="fake.someCollection"></li>

@mogadanez
Copy link
Author

Yes, I found the same workaround with wrapper

@andriijas
Copy link

<li data-each="someCollection.models"></li>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants