2017-02-23 19 views
0

使用默認的約曼默認的Oracle儀表盤產生的,說明我的問題的一部分:甲骨文噴氣 - 如何從一個模塊內的路線到另一個模塊

../src/index.html 
../src/js/appController.js 
../src/js/main.js 
../src/js/views/dashboard.html 
../src/js/views/customers.html 
../src/js/viewModels/dashboard.js 
../src/js/viewModels/customers.js 

如果我是儀表板模塊中,我想像

function DashboardViewModel() { 
... 
self.currentRowListener = function (event, ui) { 
Router.rootInstance.go('customers'); 
} 
... 

我該怎麼做?我無法找到一種方法來重定向到另一個模塊從特定模塊的白化

回答

1

Router.go功能是正確的方式來做到這一點,你只需要使用oj.Router.rootInstance獲得它。假如你正確地配置了你的路由器 - 我想在你使用默認模板的情況下 - 這應該是全部。

例子:

define(['ojs/ojcore', 'ojs/ojrouter'], function (oj) { 
    function DashboardViewModel() { 
     var self = this; 
     self.currentRowListener = function (event, ui) { 
      oj.Router.rootInstance.go('customers'); 
     } 
    } 
    return DashboardViewModel; 
}); 
+0

很不錯的它完美..我只是忘了加上OJS /路由器的定義聲明 – Dom

相關問題