O'Reilly logo

Developing an Angular 2 Edge by Ran Wahle, Mary Gualtieri, Wojciech Kwiatek, Suguru Inatomi, Filip Lauc, Troy Mott

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 8. Routing

The Angular 2 router is strictly connected to the component. It’s also called the Component Router (which is about to come to Angular 1.x as well). The main purpose of it is to have routable components. They are often smart components that are fetching resources from the API.

Configuration

Let’s start with adding a router to the app. The very beginning is to add the general URL to that app which is accessible. This usually ends up with / as the entrance point, but you may need to change it such as when you are trying to connect Angular 2 with an existing app.

The entire application is openly available at https://github.com/flauc/angular2-edge-app.

The base href is achieved by adding the element base (in index.html):

<base ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required