Exploring the Angular router

As we already know, in order to bootstrap any Angular application, we need to develop a root NgModule and a bootstrap component. The "Coders repository" application is not any different; the only addition in this specific case is that we will have multiple pages that need to be connected together with the Angular router.

Let's start with the imports required for the router's configuration and define the root component right after this:

// ch6/ts/step-0/app.ts
 
import {
  APP_BASE_HREF,
  LocationStrategy,
  HashLocationStrategy
} from '@angular/common';

import {RouterModule} from '@angular/router';

In the preceding snippet, we import the RouterModule directly from @angular/router; as we can see, the router is externalized outside ...

Get Getting Started with Angular - Second Edition 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.