【发布时间】:2015-02-19 23:33:13
【问题描述】:
我们正在使用durandaljs 开发一个应用程序,我们似乎遇到了子路由器的问题,或者至少是我们不理解或无法弄清楚的问题。让我们从一个例子开始。
Route => /part1/:id/part2/:id2/part3
问题,main.jsactivate 方法在导航时在每个级别的路由上调用:
= Root (activate called)
== Part1 (activate called)
=== Part 2 (activate called)
==== Part 3 (activate called (normal since this is the initiator of everything else since that's where we have navigating to, no more child router declare here as it live in the child router declare in Part2))
我们发现这种行为有点奇怪,想知道这是正常行为还是我们在子路由器上做错了什么。为什么每个子级别都需要重新运行他们的激活方法? IHMO,只有我们导航到的当前模型应该触发他的激活方法,并且任何其他子页面都不应该触发这个事件。
我们正在使用最新的DurandalJS,即2.1.0,并且我们正在使用Typescript 构建应用程序,尽管我认为它不会在这里改变什么。
【问题讨论】:
标签: durandal durandal-navigation