尝试获取nodeEditController
fromnodeController:startEditing
时,出现以下问题:
Uncaught TypeError: Cannot call method 'set' of undefined
这是NodeController
:
SettingsApp.NodeController = Ember.ObjectController.extend({
isEditing: false,
startEditing: function () {
debugger;
var nodeEditController = this.get('controllers.nodeEdit');
nodeEditController.set('content', this.get('content'));
nodeEditController.startEditing();
this.set('isEditing', true);
},
...
这是NodeEditController
:
SettingsApp.NodeEditController = Ember.ObjectController.extend({
needs: ['node'],
startEditing: function () {
//debugger;
// add the contact and its associated phone numbers to a local transaction
var node = this.get('content');
var transaction = node.get('store').transaction();
transaction.add(node);
// contact.get('phones').forEach(function (phone) {
// transaction.add(phone);
// });
this.transaction = transaction;
},
...
错误发生在一行中:
nodeEditController.set('content', this.get('content'));
因为:
var nodeEditController = this.get('controllers.nodeEdit');
退货undefined
。这是为什么?已NodeEditController
定义!