javascript - Expose parent Polymer element data to a child element -
javascript - Expose parent Polymer element data to a child element -
i have next structure:
<main-container data-endpoint="/api/allrecent"> <section> <list-container data-source="{{feed.recent}}" data-type="member" data-title="recent members"></list-container> </section> </main-container>
where in main-container.js
fetch info promise like:
var self = this; connector.get(this.dataset.endpoint) .then(function(data) { self.feed = json.parse(data); });
now, i'd expose self.feed
list-container
data-source. meaning when promise gets resolved, populate list-container's content.
i'm troubled on accessing feed within list-container
. i've read answers , polymer documentation haven't found proper way of achieving this.
the solution simple (like 1 attribute bind) haven't found it.
if want utilize binding need polymer element or <auto-binding>
tag model wraps <main-container>
element.
<polymer-element name="some-element" attributes="feed"> <template> <main-container data-endpoint="/api/allrecent" feed="{{feed}}"> <section> <list-container data-source="{{feed.recent}}" data-type="member" data-title="recent members"></list-container> </section> </main-container> </template> </polymer-element>
now can bind attribute <main-container>
, <list-container>
same attribute in <some-element>
.
javascript polymer
Comments
Post a Comment