ember.jsで次の問題が発生します。子コントローラーは、その内容を判別するために、親コントローラーで選択された値に依存します。データベースでは、子にparent_id参照があります。
App.parentsController = Em.ArrayController.create({
content: [],
selected: null
});
App.sonsController = Em.ArrayController.create({
// the value of content depends on the id of
// the selected item in the parentsController
content: [],
selected: null
});
App.daughtersController = Em.ArrayController.create({
// the value of content depends on the id of
// the selected item in the parentsController
content: [],
selected: null
});
私は、parentsControllerが他のコントローラーについて何も知らなくても、これを解決したいと思います。これは、オブザーバー、バインディング、または計算によっても可能になるはずですが、どこから始めればよいのかわかりません。どんな助けでも大歓迎です。