Client-Side Routing for SPA

Single Page Applications (SPA) is a term used to refer to apps that are served from just one server route but have multiple client views. The single-server route is usually the default (/ or *). Once the single-server route is loaded, the client (JavaScript) hijacks the page and starts controlling the route using the browser's routing mechanisms.

Being able to control the routes from JavaScript gives developers the ability to build better user experiences. This chapter describes how this can be done in Angular using TypeScript-written classes, directives, and so on.

Just like every other chapter, we will be doing this with practical examples.

Get TypeScript 2.x for Angular Developers now with O’Reilly online learning.

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