我正在尝试发布从一组集合生成的列表。集合包含特化和subSpecialisation(它是一个数组)。我可以生成列表,但我无法弄清楚如何删除重复项并正确匹配subSpecialisation与专业化。
EG。
收集1
"specialisation": "Accounting Firm",
"subSpecialisation": [
"Audit, Assurance & Risk",
"Business Services & Private Clients",
"Corporate Finance, Recovery & Transactions"
]
收集2
"specialisation": "Accounting in Industry",
"subSpecialisation": [
"Financial Accounting & Control",
"Management Reporting & Budgeting"
]
收集3
"specialisation": "Accounting Firm",
"subSpecialisation": [
"Audit, Assurance & Risk",
"Tax"
]
路径:template.js
specialisation() {
let specialisations = Specialisation.find( {} );
if (specialisations != null) {
return specialisations;
}
}
路径:template.html
{{#each specialisation}}
{{this.specialisation}}
{{#each subSpecialisation}}
{{this}}
{{/each}}
{{/each}}
修改 - 最终结果
Accounting Firm
- Audit, Assurance & Risk
- Tax
- Business Services & Private Clients
- Corporate Finance, Recovery & Transactions
Accounting in Industry
- Financial Accounting & Control
- Management Reporting & Budgeting