本文介绍了观察其他子控制器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有以下路由器:

  c $ c>  c  c 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.

解决方案

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.

这篇关于观察其他子控制器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 19:16
查看更多