$route (service in module ng )

Description

Is used for deep-linking URLs to controllers and views (HTML partials). It watches $location.url() and tries to map the path to an existing route definition.

You can define routes through $routeProvider's API.

The $route service is typically used in conjunction with ngView directive and the $routeParams service.

Dependencies

Methods

Properties

Events

Example

This example shows how changing the URL hash causes the $route to match a route against the URL, and the ngView pulls in the partial.

Note that this example is using inlined templates to get it working on jsfiddle as well.

Source











Demo