concept router in category aurelia

appears as: router, The router
Aurelia in Action

This is an excerpt from Manning's book Aurelia in Action.

Figure 1.9. Zooming in on the routing component of your Aurelia map, the router works by looking up a URL (in the case of the example, the /about URL) and matching it to a route found in the route dictionary. The route dictionary determines which view-model to load. In this case, you’ve specified that you want the about view-model to load whenever a user visits the #/about URL.
Figure 1.9. Zooming in on the routing component of your Aurelia map, the router works by looking up a URL (in the case of the example, the /about URL) and matching it to a route found in the route dictionary. The route dictionary determines which view-model to load. In this case, you’ve specified that you want the about view-model to load whenever a user visits the #/about URL.

In this example, you’ve added routing to your app.js view-model by configuring a set of URLs (home and about) that corresponds to components in your application. Figure 1.9 consists of two components: about and index. The router takes care of constructing the view-model for a component. The component is then rendered inside the <router-view> element in the app.html view.

To begin with, replace the contents of the /src/app.js file to include the router.