ArrayProxy であり、いくつかの計算された配列を含むコントローラーがあります。
coffeescript では、コントローラーは次のようになります。
MyApp.parentController = Ember.ArrayProxy.create
content: []
mothers: (->
mothers = (person for person in @get("content") when person.sex == 0)
).property("content")
fathers: (->
fathers = (person for person in @get("content") when person.sex == 1)
).property("content")
これは正常に動作し、コマンド ラインから 'MyApp.parentController.get("mothers")' を要求すると、期待される配列が返されます。
今、そのセットをドキュメントに表示したいので、母親のリストを反復処理したいと思います:
<div id="parent-mothers-pool">
{{#each MyApp.parentController.mothers}}
{{#view MyApp.ParentView contentBinding="this"}}{{/view}}
{{/each}}
</div>
これは機能せず、実際にはアプリケーションを完全にハングさせ、コンソールにエラーを出力することさえせずに永久にスピンします。
#each ハンドルバーから「.mother」を除外すると、予想どおり、すべての親が正しく表示されます。しかし、それを置くことはそれを台無しにします。
この計算された配列を反復するにはどうすればよいですか?