Accessing Ember-CLI Nested Controllers

杀马特。学长 韩版系。学妹 提交于 2019-12-02 12:26:09

As of Ember-CLI v0.2.1 + Ember v1.10.0 (could work for earlier versions; but I haven't tried), this is how you do it:

export default Ember.ObjectController.extend({
    needs: ["restaurant/items"],
    ...

To access actions, you'd do this:

actions: {
    myAction: function(arg1, arg2) {
      this.get('controllers.restaurant/item').send('someItemActionYouDefine', arg1, arg2);
    }
}

I don't think you're Items controller needs to be in the subfolder restaurant. Move it up a level and see if that fixes the issue.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!