O'Reilly logo

Learning Web Development with Bootstrap and AngularJS by Stephen Radford

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

Linking routes

Linking routes is no different than linking to pages on a website. We still use an anchor tag and in place of the link to the page we want to link the route.

For example, if we wanted to link up the Add Contact button in our navbar, we would do the following:

<a href="/add-contact">Add Contact</a>

Angular will automatically display the correct partial when we click the link and also change the URL. If you've opted not to use html5Mode, we can still link using an anchor tag, but the href attribute is a little different—we need to add the hash:

<a href="#/add-contact">Add Contact</a>

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