Routing

Except for really simple cases, a typical single-page application is made of multiple views. Most of the time, such an application has some fixed, global layout comprising a variable area that displays the current view and a menu that allows the user to navigate from one view to another. In Aurelia, those features are supported by the router plugin.

Configuring the router

To enable routing, make sure your application depends on the aurelia-router and the aurelia-templating-router libraries as CLI-based projects do by default. Then load the router plugin in the configure function of your main.js file, by either loading the whole standardConfiguration(), which includes the router, or by loading the router()individually. See Chapter 1, Getting ...

Get Learning Aurelia now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.