In this chapter, we explored Backbone's Router
class. You learned how Backbone simulates pages by creating routes
on a Router
class and how Routers
can operate using either hash-based or pushState-based routing. You also learned about the three different ways to add routes (via a routes
option, a routes
property, or the route
method) and the three types of routes (simple, route strings, and regular expressions). Finally, you saw how to handle missing routes, respond to routing events, use multiple Routers
, and most importantly how to combine a page view with composable sub-Views
to power your routing methods.
In the next chapter, we'll take a look at some more advanced uses of Backbone, such as using methods in place of Backbone properties, such as model
, or mixing sets of methods into multiple classes.
3.141.35.60