How to update content of one ArrayController from the selected value of another ArrayController in Ember.js
Posted
by
CodeHugger
on Stack Overflow
See other posts from Stack Overflow
or by CodeHugger
Published on 2012-06-06T15:51:24Z
Indexed on
2012/06/06
16:40 UTC
Read the original article
Hit count: 168
I have the following problem in ember.js. A child controller depends on a selected value in a parent controller in order to determine its content. In the database a child has a parent_id reference.
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
});
I would prefer to solve this without the parentsController having to know anything about the other controllers. This should be possible with observers, bindings or even through calculations but I have no clue where to start. Any help would be well appreciated.
© Stack Overflow or respective owner