P
P
Pavel2016-06-30 19:19:16
JavaScript
Pavel, 2016-06-30 19:19:16

Why use marionette's appRouter instead of the regular one (backbone)?

Version 3.0
The following piece of code can be gleaned from the official documentation:

var MyRouter = Marionette.AppRouter.extend({
  // "someMethod" must exist at controller.someMethod
  appRoutes: {
    "some/route": "someMethod"
  },

  /* standard routes can be mixed with appRoutes/Controllers above */
  routes : {
    "some/otherRoute" : "someOtherMethod"
  },
  someOtherMethod : function(){
    // do something here.
  }
});

Roughly speaking, we can define it someMethodoutside the router, just somewhere on the controller. Is this the only difference? Or is there some other convenient use of appRoute instead of the usual route?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
aen, 2016-07-03
@Carduelis

Essentially there is no difference. The puppet's AppRouter will simply allow you to specify a controller that will handle your routes. That is, you can take out the logic of processing routes in a separate entity and manipulate it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question