Мне нужно вызвать функцию в ItemController/или установить новое свойство дочернего элемента ItemController из ArrayController.Как получить доступ к ItemController от ArrayController
Для лучшей картины
App.ProductsController = Ember.ArrayController.extend({
needs: ["product"],
itemController: 'product',
contentChanged: function() { //no idea how to initiate this, hence I use observes
// How do I access the children controllers from here?
// I had tried below, but not working:
// this.get("content").forEach(function(item) {
// item.doSomething();
// });
}.observes('content')
});
App.ProductController = Ember.ObjectController.extend({
doSomething: function() {
//supposed to do something
}
});
Я не нашел способ сделать это.
Nope, то «this.forEach» не перебирать subControllers вообще. – Yman
Хорошо, исправление, вы правы, что «this.forEach» возвращает itemController. Я узнал, что проблема на самом деле «наблюдает». Я поставлю правильный способ ждать решения ниже. В любом случае, спасибо! Дал +1 – Yman