-
Notifications
You must be signed in to change notification settings - Fork 20
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
Demo to illustrate data binding inside generic element? #11
Comments
I've been playing with putting some tags on a page and using databinding. The trouble is, you can put data in using databinding, but you can't get it out again. I tried stepping through the code to find out why, and it never appears to write the value back to the value attribute, so although it has notify:true on it, the value is put into the meta data and that is as far as it goes. Of course, as per the docs, you can imperatively query it in code. I think one way of doing it might be to use <iron-meta-query key="[[binding]]", value="{{anotherbinding}}"> - if you change the key value, it then outputs the correct value for the new key - but it seems messy. |
Having found that iron-meta did not appear to work with data binding, I have built my own version (akc-meta) that seems to work well with data binding. This keeps a list of query elements with a particular key in shared storage, so when the value changes on the input element, it sends a new value out to all the query elements in that list, writing it back to the value property. This has the notify:true flag, so gets passed into the data binding system. |
you can use iron-meta to store the value you want to share and iron-meta-query to query it and bind to an object. for instance: in one component you define
in another component you can access it simply doing
the user is {{_user.name}} |
@veronicawwashington Would you be interested in sending a PR to update the demo? It would be much appreciated! 🍰 |
2 way binding ! A feature still needed, I think for the lack of Global Polymer Attributes/Variables which support data binding. |
Shouldn't the demo illustrate binding an
<iron-meta>
variable inside a generic custom element? That use case seems to better reflect the intended purpose of the<iron-meta>
element.Example: (maybe something like this...)
I am just learning Polymer so I am probably just missing something or doing something dumb.
The text was updated successfully, but these errors were encountered: