mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-04-21 07:10:59 +00:00
Currently, the documentation does a bad job of explaining the distinction between the services that it provides,
and the module itself. Furthermore, the instructions for using optional modules are inconsistent or missing.
This commit addresses the problem by ading a new `{@installModule foo}` annotation to the docs generator that
inlines the appropriate instructions based on the name of the module.
41 lines
1.4 KiB
JavaScript
41 lines
1.4 KiB
JavaScript
'use strict';
|
|
|
|
ngRouteModule.provider('$routeParams', $RouteParamsProvider);
|
|
|
|
|
|
/**
|
|
* @ngdoc object
|
|
* @name ngRoute.$routeParams
|
|
* @requires $route
|
|
*
|
|
* @description
|
|
* The `$routeParams` service allows you to retrieve the current set of route parameters.
|
|
*
|
|
* Requires the {@link ngRoute `ngRoute`} module to be installed.
|
|
*
|
|
* The route parameters are a combination of {@link ng.$location `$location`}'s
|
|
* {@link ng.$location#search `search()`} and {@link ng.$location#path `path()`}.
|
|
* The `path` parameters are extracted when the {@link ngRoute.$route `$route`} path is matched.
|
|
*
|
|
* In case of parameter name collision, `path` params take precedence over `search` params.
|
|
*
|
|
* The service guarantees that the identity of the `$routeParams` object will remain unchanged
|
|
* (but its properties will likely change) even when a route change occurs.
|
|
*
|
|
* Note that the `$routeParams` are only updated *after* a route change completes successfully.
|
|
* This means that you cannot rely on `$routeParams` being correct in route resolve functions.
|
|
* Instead you can use `$route.current.params` to access the new route's parameters.
|
|
*
|
|
* @example
|
|
* <pre>
|
|
* // Given:
|
|
* // URL: http://server.com/index.html#/Chapter/1/Section/2?search=moby
|
|
* // Route: /Chapter/:chapterId/Section/:sectionId
|
|
* //
|
|
* // Then
|
|
* $routeParams ==> {chapterId:1, sectionId:2, search:'moby'}
|
|
* </pre>
|
|
*/
|
|
function $RouteParamsProvider() {
|
|
this.$get = function() { return {}; };
|
|
}
|