Routing (ngRoute)

The ngRoute module is a module that will allow you to configure routing in your application. Routing is listening for changes to the location and then automatically responding to those changes with a new controller and template. It uses ngView, $routeProvider, and $route.

Note

Your module will need to depend on ngRoute to use these directives and services. We will also need to include the Angular route JavaScript in our HTML.

ngView

This works with the $route service as a spot for content:

<ng-view [onload=''] [autoscroll='']/>
<element ng-view [onload=''] [autoscroll='']/>

Parameters

  • onload(Angular expression): This evaluates on load.
  • autoscroll(Angular expression): Whether or not $anchorScroll is used with this ngView. By default, ...

Get Web Developer's Reference Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.