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

Feature Request: Data Binding between Distributed Children and Host #3617

Closed
safizn opened this issue Apr 26, 2016 · 1 comment
Closed

Feature Request: Data Binding between Distributed Children and Host #3617

safizn opened this issue Apr 26, 2016 · 1 comment

Comments

@safizn
Copy link

safizn commented Apr 26, 2016

Allow data binding between distributed children and host. There isn't any easy way for binding data to distributed children, which must exist inside the document dom.
Maybe not in a sense of piercing through the content, rather allowing anonymous data binding in "template is=dom-bind" with {{data}} applied to host and child. No one likes exceptions, distributed children should be able to bind to attributes of their host in a simple way. (as shown in the below example).

Use Case - In my use case the distributed children must exist inside the document dom, & cannot exist inside another local dom (to share a property for example between distributed children and host, through the use of a grandparent element).
For examples - Using carbon-route, I need to share the data attribute between host element and distributed children, each content child is a page/view in *-pages (e.g. iron-pages). Basically trying to create a builder which allows each user to specify his own routes and pages. The page elements (custom element views for the pages) are added in the server side according to the user's settings. The user can choose to change/use a different custom element to view his content. Together with integrating other server side platforms. Therefore distributed children must be in the document dom.

I've tried:

  • iron-meta only allows one way binding. And there aren't much changes since mid-2015 concerning this issue, as stated here Demo to illustrate data binding inside generic element? PolymerElements/iron-meta#11
  • Global Polymer Attributes - doesn't exist, there are no global variables with binding features. All must be inside of a local dom to serve as an intermediate and share properties together.
  • Using - didn't work.
    <template is="dom-bind">
    <host-element routeData="{{routeData}}">
    <distributedchild-element routeData="{{routeData}}"></distributedchild-element>
    </host-element>
    </template>

    I feel frustrated, there isn't any easy way for binding data to distributed children, which exist inside the document dom. Now I'm forced to move the distributed content elements into the local dom. Passing settings and custom elements through the element's attribute is messy & impossible in my use case.

    Thank you.

@safizn
Copy link
Author

safizn commented Apr 26, 2016

Actually it is possible to use data-binding. I had an error in the camelcase of the attribute markup which prevented the binding functionality.
I used routeData ="{{...}}" instead of route-data="{{...}}".
Now it works fine in both "template is=dom-bind" as anonymous attribute & in case of binding to nodes inside local DOM.

@safizn safizn closed this as completed Apr 26, 2016
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

1 participant