$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 redundant 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 – {(string|function()=} – Controller fn that should be associated with newly
created scope or the name of a registered controller
if passed as a string.template – {string=} – html template as a string that should be used by
ngView or
ngInclude directives.
this property takes precedence over templateUrl.templateUrl – {string=} – path to an html template that should be used by
ngView.resolve - {Object.<string, function>=} - An optional map of dependencies which should
be injected into the controller. If any of these dependencies are promises, they will be
resolved and converted to a value before the controller is instantiated and the
$routeChangeSuccess event is fired. The map object is:
key – {string}: a name of a dependency to be injected into the controller.factory - {string|function}: If string then it is an alias for a service.
Otherwise if function, then it is injected
and the return value is treated as the dependency. If the result is a promise, it is resolved
before its value is injected into the controller.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 templateUrl.{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