Reputation: 805
I have inserted this nested data in my minimongo
db.orders.insert({
_id: ObjectId().str,
name: "admin",
status: "online",catalog : [{
"objectid" : ObjectId().str,
"message" : "sold",
"status" : "open"
}]
});
and i am trying to display it with this code
<template name="Listed">
<div class="row">
{{#each list}}
<article class="post">
<a href="{{pathFor route='edit'}}"><h3>{{_id}}</h3></a>
<a href="{{pathFor route='edit'}}"><h3>{{name}}</h3></a>
<br>
<a href="{{pathFor route='create'}}"><h3>{{status}}</h3></a>
<br>
{{#each ../catalog}}
<a href="{{pathFor route='create'}}"><h3></h3></a>
<a href="{{pathFor route='create'}}"><h3>{{status}}</h3></a>
{{/each}}
<div class="well"></div>
<br/>
</article>
<br/><br/>
{{/each}}
</div>
</template>
but the nested data is not being displayed. How can i display the nested data?.
This is my data helper
/*****************************************************************************/
/* Listed: Helpers */
/*****************************************************************************/
Template.Listed.helpers({
'list': function(){
return Orders.find();
}
});
Upvotes: 0
Views: 103
Reputation: 952
you need to remove ../
<template name="Listed">
<div class="row">
{{#each list}}
<article class="post">
<a href="{{pathFor route='edit'}}"><h3>{{_id}}</h3></a>
<a href="{{pathFor route='edit'}}"><h3>{{name}}</h3></a>
<br>
<a href="{{pathFor route='create'}}"><h3>{{status}}</h3></a>
<br>
{{#each catalog }}
<a href="{{pathFor route='create'}}"><h3></h3></a>
<a href="{{pathFor route='create'}}"><h3>{{status}}</h3></a>
{{/each}}
<div class="well"></div>
<br/>
</article>
<br/><br/>
{{/each}}
</div>
</template>
```
Upvotes: 2