Durandal有没有办法获取当前模块的路径?我在SPA内部构建了一个仪表板,并且想要像Durandal对“FolderWidgetName”所做的那样组织我的小部件,并且该文件夹将包含一个controller.js和view.html文件。我尝试在我的controller.js文件中使用getView()方法,但无法使其在当前文件夹中查看视图。Durandal,获取当前模块的路径
getView(){
return "view"; // looks in the "App" folder
return "./view"; // looks in the "App/durandal" folder
return "/view"; // looks in the root of the website
return "dashboard/widgets/htmlviewer/view" //don't want to hard code the path
}
- 我不想硬编码在控制器内的路径
- 我不想覆盖viewlocator,因为该应用程序还充当常规迪朗达尔温泉其余使用标准约定。
任何想法如何让生命周期事件使用撰写结合何时启用?我之前曾经遇到过这个问题,并且在Google工作组中提出了一个问题https://groups.google.com/forum/#!topic/durandaljs/PhNrL6skqtU但从未得到答案 – Tyler
当您激活一条新路线只要您将其暴露给路由器,就会自动在先前的视图模型上调用停用。这似乎是你的问题在谷歌组。 –
克里斯还需要从您的激活函数返回一个回调,这在示例中并不清楚。 –