我必须在“/ 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