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

Computed bindings are not updated when using polymer's this.push to add elements #1822

Closed
xmakro opened this issue Jun 10, 2015 · 4 comments
Closed

Comments

@xmakro
Copy link

xmakro commented Jun 10, 2015

http://jsfiddle.net/3e3d8kzz/4/

In the example, the computed binding only updates when resetting the array using line 10-12 in the example.

@arthurevans
Copy link

This computed binding selected$="{{computeInArray(selected, item)}}" only recomputes when the property itself changes. To observe array changes, you can use selected.* or selected.splices:

http://jsfiddle.net/3e3d8kzz/1/

@xmakro
Copy link
Author

xmakro commented Jun 10, 2015

Can you please post an example? I think your jsfiddle url links to my example.

@arthurevans
Copy link

Sorry, not used to jsfiddle. Here it is:

http://jsfiddle.net/b4gdksu4/2/

I'm sure this could be more efficient, but it works. More information on observing this kind of change:

https://www.polymer-project.org/1.0/docs/devguide/properties.html#deep-observation

@xmakro
Copy link
Author

xmakro commented Jun 11, 2015

Thanks it works great!

@xmakro xmakro closed this as completed Jun 11, 2015
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

2 participants