我必須在「/ b」路線上提供我的骨幹應用程序,並且無法連接到路由器。它工作正常,如果我只showView視圖,但我的路由控制器功能沒有發射時,我掛在我的路由器,任何想法?非索引根路徑與Marionette路由器
路由器:
define('appRouter', ['marionette', 'rootView', 'changePasswordView'], function(Marionette, rootView, changePasswordView) {
return Marionette.AppRouter.extend({
routes: {
'/b/change-password': 'showChangePassword',
'/b': 'showAccountSettings'
},
showChangePassword: function() {
this.showView(new changePasswordView());
},
showAccountSettings: function() {
this.showView(new rootView());
}
});
});
應用在onStart(這是確定射擊):
var Application = Marionette.Application.extend({
...
onStart: function(options) {
console.log('on start');
var router = new appRouter(options);
/** Starts the URL handling framework */
if(! Backbone.History.started) Backbone.history.start();
router.initialize();
},
...
});
當我訪問http://localhost:8080/b
(這是所有密集的目的,我的指數),它呈現一個空白頁。
你在哪裏登記在Marionette.Application的路線?你可以發佈代碼嗎? –
這可能是我錯過了,onStart顯示在應用程序= Marionette.Application.extend({...})'''class extension – goofiw