Routing-specific patterns, tips, and tricks

The earlier sections of this chapter gave us a good overview of the AngularJS APIs, related to handling navigation in single-page web applications. Here we are going to see practical examples of using those APIs, and discuss the best related practices.

Handling links

The HTML anchor tag (a) is a primary tool for creating navigation links. AngularJS has special treatment for those links and the following subsections will guide through AngularJS specifics.

Creating clickable links

AngularJS comes pre-bundled with the a directive, which prevents default actions on links when the href attribute is omitted. This allows us to create clickable elements using the a tag and the ng-click directive. For example, we ...

Get Mastering Web Application Development with AngularJS now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.