Polymer 1.0: Nested dom-repeat templates cannot render content of child object
I want to display object content (comments) in post data (using firebase collection): Here is the post structure in firebase:
"Publication" : {
"date":"22-06-2015",
"content" : "post example",
"comments": {
//a post has too many comments on it
}
}
My goal is to add another dom-repeat to show comments, but I can't see anything. Here is some sample code (the first template works correctly as I mentioned)
<template is="dom-repeat" items="{{posts}}" as="post">
<!-- Content here is appearing correctly -->
<template is="dom-repeat" items="{{post.comments}}" as="commentaire">
<span>{{commentaire.date}}</span>
</template>
</tempalte>
I have followed the Polymer migration documentation but no results, I would appreciate any solution.
+3
source to share
2 answers
You can try this without the 'as' tag.
<template is="dom-repeat" items="{{posts}}">
<template is="dom-repeat" items="{{item.comments}}">
<span>{{item.date}}</span>
</template>
</tempalte>
I understand that "elements" is an internal term for a polymer that represents an array / object. I may not be entirely correct, but this trick worked for me.
0
source to share