この一見単純な問題を解決できないようです。
バックボーン/マリオネット アプリケーションがあり、ルーターを次のように定義します。
app.utils.AppRouter = Backbone.Marionette.AppRouter.extend({
initialize: function(){
this.route("", "home", function(){
console.log("In home!");
app.layout.content.show(new app.views.BrowseRestaurantsLayout());
});
this.route("account", "account", function(){
console.log("In account!");
app.layout.content.show(new app.views.AccountView());
});
}
});
コードの別の場所で、#account
ページに移動する必要があるため、次のように呼び出します。
app.router.navigate('account', {trigger:true});
URL が に変わり#account
、自分のAccountView
ページが一瞬表示されてから消え、ホームページに置き換わっていることがわかります。
変更をトリガーすると、コンソールに次のように表示されます。
In account!
In home!
私は何が欠けていますか?