Backbone.js: Router Cheat Sheet

MethodsSyntaxDescription
extendBackbone.Router.extend(properties, [classProperties])It extends the backbone’s router class.
routesrouter.routesIt defines the URL representation of applications objects.
preinitializenew Backbone.Router([options])For use with routers as ES classes.
constructor / initializenew Router([options])It creates a new constructor for the router instantiation.
routerouter.route(route, name, [callback])It creates a route for the router.
navigaterouter.navigate(fragment, [options])It is used to update the URL in the applications.
executerouter.execute(callback, args, name)It is used when a route matches its corresponding callback.

Leave a Reply

Your email address will not be published. Required fields are marked *