Posted On: Feb 22, 2018
The routes are configured in the appRoutes. The definition of the route is passed to Backbone’s standard routing handlers. You have to provide a callback method that exists on the controller instead of a callback function that exists on the router.
Example of configuration routes with appRoute
var MyRouter = Backbone.Marionette.AppRouter.extend({ // "someMethod" must exist at controller.someMethod appRoutes: { "some/route": "someMethod" }, /* standard routes are mixed with appRoutes/Controllers above */ routes : { "some/otherRoute" : "someOtherMethod" }, });
The routes can also be configured in the constructor.
Example
var MyRouter = new Marionette.AppRouter({ controller: myController, appRoutes: { "foo": "doFoo", "bar/:id": "doBar" } });
Never Miss an Articles from us.
Marionette.js is a composite application library for the Backbone.js. It simplifies the construction of the large-scale JavaScript applications. It is nothing but a collection of the common design and...
Features of Marionette.jsIt is scalable as the applications built-in modules with event-driven architecture. It is easily modifiable. It works with the specific need of your application. It has ...
v4.1.2 is the current stable version of MarionetteJS....