0
如何在SCA(Handlebars)模板語言中嵌套for循環?對SCA模板中的數組進行迭代
例如;我有數組的數組和我要循環內數組元素:
// Loop 1
{{#each footerNavigationLinks}}
<ul class="footer-content-nav-list">
// Nested loop
{{#each objectToAtrributes item}}
<li>aa
<a {{objectToAtrributes item}}>
{{text}}
</a>
</li>
{{/each}}
</ul>
{{/each}}
而且footerNavigationLinks
是數組的數組:
footerNavigationLinks: [
[
{text: 'Link a', href:'#'}
, {text: 'Link b', href:'#'}
, {text: 'Link c', href:'#'}
],
[
{text: 'Link a', href:'#'}
, {text: 'Link b', href:'#'}
, {text: 'Link c', href:'#'}
]
]