Chapter 19Client-side Routing

In Chapter 18, we demonstrated how to make Ajax requests to our Express server and load the results into $scope to display the results. That’s great for a single-page website, but most applications span more than a single page. In Listing 18-2, what if we wanted to add a new screen that could be used to edit an employee? The application needs to change pages and display a new view, but we want to use the benefits of an Ajax request and not lose all of our JavaScript state and static files in the browser’s memory. We also want that page to be bookmarkable, so the page has to be stateless.

This is where client-side routing really shines. Client-side routing allows developers to create standard anchor tags throughout ...

Get Full Stack JavaScript Development With MEAN now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.