O'Reilly logo

Learning Angular for .NET Developers by Rajesh Gunasundaram

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

Routing in Angular

As we saw in Chapter 3, Angular Building Blocks - Part 2, Angular introduced a component router that deep links the URL request, maps the component that is annotated for this route, and renders the template or view associated with the component. The Angular router is not part of the core Angular framework. It comes as part of the Angular router module. We need to add the reference to this library in package.json, as follows, under the dependencies section:

"dependencies": {"@angular/router": "~4.0.0",}

Then, we need to add the <base> element under <head> to instruct the router to set up navigation URLs. The following code snippet shows the <base> tag with the href attribute that should be added to the head tag in the ...

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