Ember の Need Api を使用して、コントローラーのメソッドを別のコントローラーで呼び出しています。コントローラーのインスタンスを取得できますが、メソッドを呼び出すと、このエラーが返されます TypeError: Object [object Object] has no method.
これが私がそれを呼んでいる方法です:
Cards.CardsIndexController = Ember.Controller.extend({
needs: 'account_info',
actions: {
accountInfoStart:function(){
console.log(this.get('controllers.account_info').test()); // error here
}
}
});
これは、関数を呼び出したいコントローラーです
Cards.AccountInfoController = Ember.Controller.extend({
actions:{
test: function(){
alert(1);
}
}
});
どうすれば解決できますか?