K
K
Klein Maximus2016-03-22 12:45:49
JavaScript
Klein Maximus, 2016-03-22 12:45:49

How to set up routing in Backbone.Marionette modules?

I add modules to the Backbone.Marionette application:

start: function( options ) {
            
            Marionette.Application.prototype.start.apply( this, [ options ] );
            
            this.Router = new Router( { controller: new Controller() } ); 
            
            this.module( 'Auth', { moduleClass: AuthModule } );
            this.module( 'List', { moduleClass: ListModule } );
            this.module( 'Cabinet', { moduleClass: CabinetModule } );
            
            Backbone.history.start( { pushState: true } );
            
},

Modules define their own routers.
When trying to call app.Router.navigate('route'), which is in the application's router, everything is fine.
But when I try to call a route from a module in the same way, for obvious reasons, it is not called.
The question arises, how to call the navigate method so that the route selection occurs not only in the list of application routes, but also module routes are involved?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Klein Maximus, 2016-03-22
@kleinmaximus

The question is removed.
Should have been called with trigger: true
app.Router.navigate( 'route', { trigger: true} );

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question