* @ngdoc object * @name ng.$routeProvider * @function * * @description * * Used for configuring routes. See ng.$route $route for an example.
()
| 7051 | * Used for configuring routes. See {@link ng.$route $route} for an example. |
| 7052 | */ |
| 7053 | function $RouteProvider(){ |
| 7054 | var routes = {}; |
| 7055 | |
| 7056 | /** |
| 7057 | * @ngdoc method |
| 7058 | * @name ng.$routeProvider#when |
| 7059 | * @methodOf ng.$routeProvider |
| 7060 | * |
| 7061 | * @param {string} path Route path (matched against `$location.path`). If `$location.path` |
| 7062 | * contains redundant trailing slash or is missing one, the route will still match and the |
| 7063 | * `$location.path` will be updated to add or drop the trailing slash to exactly match the |
| 7064 | * route definition. |
| 7065 | * |
| 7066 | * `path` can contain named groups starting with a colon (`:name`). All characters up to the |
| 7067 | * next slash are matched and stored in `$routeParams` under the given `name` when the route |
| 7068 | * matches. |
| 7069 | * |
| 7070 | * @param {Object} route Mapping information to be assigned to `$route.current` on route |
| 7071 | * match. |
| 7072 | * |
| 7073 | * Object properties: |
| 7074 | * |
| 7075 | * - `controller` – `{(string|function()=}` – Controller fn that should be associated with newly |
| 7076 | * created scope or the name of a {@link angular.Module#controller registered controller} |
| 7077 | * if passed as a string. |
| 7078 | * - `template` – `{string=}` – html template as a string that should be used by |
| 7079 | * {@link ng.directive:ngView ngView} or |
| 7080 | * {@link ng.directive:ngInclude ngInclude} directives. |
| 7081 | * this property takes precedence over `templateUrl`. |
| 7082 | * - `templateUrl` – `{string=}` – path to an html template that should be used by |
| 7083 | * {@link ng.directive:ngView ngView}. |
| 7084 | * - `resolve` - `{Object.<string, function>=}` - An optional map of dependencies which should |
| 7085 | * be injected into the controller. If any of these dependencies are promises, they will be |
| 7086 | * resolved and converted to a value before the controller is instantiated and the |
| 7087 | * `$routeChangeSuccess` event is fired. The map object is: |
| 7088 | * |
| 7089 | * - `key` – `{string}`: a name of a dependency to be injected into the controller. |
| 7090 | * - `factory` - `{string|function}`: If `string` then it is an alias for a service. |
| 7091 | * Otherwise if function, then it is {@link api/AUTO.$injector#invoke injected} |
| 7092 | * and the return value is treated as the dependency. If the result is a promise, it is resolved |
| 7093 | * before its value is injected into the controller. |
| 7094 | * |
| 7095 | * - `redirectTo` – {(string|function())=} – value to update |
| 7096 | * {@link ng.$location $location} path with and trigger route redirection. |
| 7097 | * |
| 7098 | * If `redirectTo` is a function, it will be called with the following parameters: |
| 7099 | * |
| 7100 | * - `{Object.<string>}` - route parameters extracted from the current |
| 7101 | * `$location.path()` by applying the current route templateUrl. |
| 7102 | * - `{string}` - current `$location.path()` |
| 7103 | * - `{Object}` - current `$location.search()` |
| 7104 | * |
| 7105 | * The custom `redirectTo` function is expected to return a string which will be used |
| 7106 | * to update `$location.path()` and `$location.search()`. |
| 7107 | * |
| 7108 | * - `[reloadOnSearch=true]` - {boolean=} - reload route when only $location.search() |
| 7109 | * changes. |
| 7110 | * |