Routing Angular Applications

Router Links

Now that we have our app routed, we just need to create links over to those pages.

Instead of using <a href="/about">About</a>, we'll use the Angular 2 router way of linking to different routes:

<a routerLink="/about">About</a>

The router uses the HTML5 History API so that each page we navigate to will be part of the history.

Also, unlike Angular 1, we aren't using the hashbang way of routing (ie http://localhost:3000/#/about).

By default, we will be using HTML5 push-state.

Like this article? Follow @chrisoncode on Twitter