DurandalJS:在路由参数更改后,组合内的activate()回调未运行

时间:2013-10-16 13:45:50

标签: javascript durandal

这是我的设置:

  • shell.js(包括主路由器)
  • shell.html
  • 办公室
    • shell.js(包括子路由器)
    • shell.html
    • sidebar.js
    • sidebar.html
    • 员工
      • 的index.html
      • index.js

主shell包括到办公室页面的路线,其中包括属于该办公室的员工列表:

{ route: 'offices/:id', moduleId: 'offices/shell' }

子shell包含指向办公室页面侧栏的组合。

<aside data-bind="compose: { model:'offices/sidebar', view:'offices/sidebar' }"></aside>

问题是sidebar.js中的激活回调只在我第一次加载页面时运行,而不是在路由的id参数发生变化时运行。

因此,当我从offices/12更改为offices/15时,唯一运行的是office / shell.js中的激活回调以及employees / index.js中的激活回调。

有没有办法重新激活合成?

谢谢!

0 个答案:

没有答案
相关问题