Observes other childcontroller?

我怕爱的太早我们不能终老 提交于 2019-12-13 04:41:37

问题


I am trying to observe another childcontroller.

I have the following router:

this.resource('generics', {path: '/gens'}, function() {
    this.resource('generic', {path: '/:generic_id'}, function() {  
        this.route('prepare'); // Objectcontroller
        this.route('sent'); // Objectcontroller
    });
}); 

I have an observer in the sent controller, however it does not work. I have currently: 'controllers.sent.id' to get the id prepared in the prepare controller. If I do a needs property with generic.prepare. It shows this error:

#needs must not specify dependencies with periods in their names (generic.sent)

I have also tried to use setupController to add the id to the sent controller properties, however the observer is worthless then.


回答1:


it would be genericPrepare, but prepare/sent should never exist at the same time. You'd probably be better off sending the object to generic and then having sent grab the property off of it. Why are you against setting it up during setupController? The route will always hit setupController of sent before it's visible to the end user.



来源:https://stackoverflow.com/questions/22635782/observes-other-childcontroller

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