-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Custom element bind attribute as object not converted #1344
Comments
So you have two very different use cases here. In #1, you're initializing data using an attribute (and Polymer is JSON parsing the value). In #2, you're binding the
(By the way, are you actually looking for a one-time binding here? If not use '{{}}') In the calling object, you can create this object using a computed property, if you like:
There are a number of ways you could go about creating the object depending on your use case, but the key factor here is that bindings and static configuration (using attributes) are different beasts. See: https://www.polymer-project.org/0.5/docs/polymer/polymer.html#published-properties (Especially the section, "Configuring an element via attributes".) And (Especially the section "Binding objects and arrays to published properties".) Hope this helps. |
Good example, however, there is one thing I didn't mention, the bind object passed to <template repeat="{{ entry in response.result }}">
<custom-element data='{"title": "[[ entry.title ]]"}'></custom-element>
</tempalte> How to access the |
In that case, I think your best bet in 0.5 is to use an inline function in the binding. It could be as simple as:
This form will work fine as long as you're not manipulating any of the properties of If you do change the properties elsewhere, I'd recommend feeding them directly to the function, which ensures that they get observed for changes:
This way, if you change |
@kevinpschaaf Not sure what the solution is for this in 0.8. Food for thought. |
@arthurevans Thank you for help. I really appreciate it. Will do some implementations to see if they fully fit my case. Cheers! |
Closing this issue due to age and the release of version 1 of Polymer - please feel free to re-open if this is incorrect. |
Here's a custom component
Calling element:
Any ideas how to fix this?
Thanks.
The text was updated successfully, but these errors were encountered: