观察其他子控制器? [英] Observes other childcontroller?

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

问题描述



我有以下路由器:

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

我在发送的控制器中有一个观察者,但是它不起作用。我目前有:controllers.sent.id来获取准备控制器中的id。
如果我执行需要属性与 generic.prepare 。它显示这个错误:

  #needs不能在其名称(generic.sent)中指定具有句点的依赖项

我也试图使用setupController将id添加到发送的控制器属性,但是观察者是毫无价值的。 p>

解决方案

它将是 genericPrepare ,但 / code> / 发送不应该同时存在。您可能会将对象发送到通用,然后将发送抓取该属性。为什么不反对在 setupController 中设置? 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.

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆