我需要 Ember 中的递归嵌套视图集。基本上将其视为带有文件夹的文件结构。
我以为我可以做到这一点render
,但没有奏效。内景structures/show
:
{{#each child in structures}}
{{ render 'structures/show' child }}
{{/each}}
我得到错误:
Uncaught Error: assertion failed: This view is already rendered
我在另一个关于使用帮助器的SO Question中读到{{view}}
:
{{#each child in structure.structures}}
{{ view App.StructuresShowView structureBinding='child'}}<br>
{{/each}}
但这不能正确渲染。可能是因为示例太旧了?
如何使用不同的对象正确渲染相同的视图(和控制器?)以构建嵌套/递归视图?有没有比对象方向更好的方法?
谢谢。
更新。看起来itemControllerClass可能是我要找的?仍在试图弄清楚。