$routeProvider
(service in module ng
)
Used for configuring routes. See $route
for an example.
Sets route definition that will be used on route change when no other route definition is matched.
params – {Object} –
Mapping information to be assigned to $route.current
.
{Object}
– self
Adds a new route definition to the $route
service.
path – {string} –
Route path (matched against $location.path
). If $location.path
contains redudant trailing slash or is missing one, the route will still match and the
$location.path
will be updated to add or drop the trailing slash to exacly match the
route definition.
route – {Object} –
Mapping information to be assigned to $route.current
on route
match.
Object properties:
controller
– {function()=}
– Controller fn that should be associated with newly
created scope.template
– {string=}
– path to an html template that should be used by
ngView
or
ngInclude
directives.redirectTo
– {(string|function())=} – value to update
$location
path with and trigger route redirection.
If redirectTo
is a function, it will be called with the following parameters:
{Object.<string>}
- route parameters extracted from the current
$location.path()
by applying the current route template.{string}
- current $location.path()
{Object}
- current $location.search()
The custom redirectTo
function is expected to return a string which will be used
to update $location.path()
and $location.search()
.
[reloadOnSearch=true]
- {boolean=} - reload route when only $location.search()
changes.
If the option is set to false
and url in the browser changes, then
$routeUpdate
event is broadcasted on the root scope.
{Object}
– self