[英]How do I access an array within an Object having dynamic index in handlebar?
i am trying to access the following array within a handlebars template:我正在尝试在车把模板中访问以下数组:
myobj= {
'5d842f0706f2a639183226bc': [
{
order_no: '5d842f0706f2a639183226bc',
order_date: 'Sep 20, 2019',
products: [Object],
supplier: [Object],
quantity: 1
}
],
'5d842e6406f2a639183226b9': [
{
order_no: '5d842e6406f2a639183226b9',
order_date: 'Sep 20, 2019',
products: [Object],
supplier: [Object],
quantity: 1
}
]
}
tried试过了
{{#each mail_obj }}
{{#each @index}}
<p> {{this.order_no}}
{{/each}}
{{/each}}
If the above is not possible, how would I write a helper that could access a specific item within the array?如果上述不可行,我将如何编写一个可以访问数组中特定项目的助手?
Please use this in your.hbs file请在您的.hbs 文件中使用它
{{#each myobj as |item|}}
{{#each item as |details|}}
<p>{{details.order_no}}</p>
<p>{{details.order_date}}</p>
{{/each}}
{{/each}}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.