EmberJS Nested Views and Controllers

前端 未结 4 1157
清歌不尽
清歌不尽 2021-02-04 13:22

I\'m writing an app with EmberJS v1.0.pre. I have an ArrayController which contains a list of all persons. There are a bunch of nested views showing the person, the

4条回答
  •  别那么骄傲
    2021-02-04 13:54

    I'm new to Ember and have been looking for a way to do something similar. In the top-level ArrayController, I just used the itemController property and it worked great:

    App.PeopleController = Ember.ArrayController.extend({
        itemController: "Person"
    });
    
    App.PersonController = Ember.ObjectController.extend //...
    

    My complete solution is in this js fiddle. Unfortunately, the way I'm getting the PetController instances to work seems hacky to me.

提交回复
热议问题