diff options
Diffstat (limited to 'src/ngRoute/route.js')
| -rw-r--r-- | src/ngRoute/route.js | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/src/ngRoute/route.js b/src/ngRoute/route.js index 50e2405a..060e2208 100644 --- a/src/ngRoute/route.js +++ b/src/ngRoute/route.js @@ -12,7 +12,7 @@ * {@installModule route} * */ - + /* global -ngRouteModule */ var ngRouteModule = angular.module('ngRoute', ['ng']). provider('$route', $RouteProvider); @@ -64,9 +64,9 @@ function $RouteProvider(){ * * Object properties: * - * - `controller` – `{(string|function()=}` – Controller fn that should be associated with newly - * created scope or the name of a {@link angular.Module#controller registered controller} - * if passed as a string. + * - `controller` – `{(string|function()=}` – Controller fn that should be associated with + * newly created scope or the name of a {@link angular.Module#controller registered + * controller} if passed as a string. * - `controllerAs` – `{string=}` – A controller alias name. If present the controller will be * published to scope under the `controllerAs` name. * - `template` – `{string=|function()=}` – html template as a string or a function that @@ -95,10 +95,10 @@ function $RouteProvider(){ * - `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 {@link api/AUTO.$injector#invoke 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. Be aware that `ngRoute.$routeParams` will - * still refer to the previous route within these resolve functions. Use `$route.current.params` - * to access the new route parameters, instead. + * 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. Be aware that + * `ngRoute.$routeParams` will still refer to the previous route within these resolve + * functions. Use `$route.current.params` to access the new route parameters, instead. * * - `redirectTo` – {(string|function())=} – value to update * {@link ng.$location $location} path with and trigger route redirection. @@ -210,8 +210,15 @@ function $RouteProvider(){ }; - this.$get = ['$rootScope', '$location', '$routeParams', '$q', '$injector', '$http', '$templateCache', '$sce', - function( $rootScope, $location, $routeParams, $q, $injector, $http, $templateCache, $sce) { + this.$get = ['$rootScope', + '$location', + '$routeParams', + '$q', + '$injector', + '$http', + '$templateCache', + '$sce', + function($rootScope, $location, $routeParams, $q, $injector, $http, $templateCache, $sce) { /** * @ngdoc object @@ -240,8 +247,9 @@ function $RouteProvider(){ * * You can define routes through {@link ngRoute.$routeProvider $routeProvider}'s API. * - * The `$route` service is typically used in conjunction with the {@link ngRoute.directive:ngView `ngView`} - * directive and the {@link ngRoute.$routeParams `$routeParams`} service. + * The `$route` service is typically used in conjunction with the + * {@link ngRoute.directive:ngView `ngView`} directive and the + * {@link ngRoute.$routeParams `$routeParams`} service. * * @example This example shows how changing the URL hash causes the `$route` to match a route against the @@ -369,7 +377,8 @@ function $RouteProvider(){ * * @param {Object} angularEvent Synthetic event object. * @param {Route} current Current route information. - * @param {Route|Undefined} previous Previous route information, or undefined if current is first route entered. + * @param {Route|Undefined} previous Previous route information, or undefined if current is + * first route entered. */ /** @@ -464,7 +473,8 @@ function $RouteProvider(){ last = $route.current; if (next && last && next.$$route === last.$$route - && angular.equals(next.pathParams, last.pathParams) && !next.reloadOnSearch && !forceReload) { + && angular.equals(next.pathParams, last.pathParams) + && !next.reloadOnSearch && !forceReload) { last.params = next.params; angular.copy(last.params, $routeParams); $rootScope.$broadcast('$routeUpdate', last); @@ -491,7 +501,8 @@ function $RouteProvider(){ template, templateUrl; angular.forEach(locals, function(value, key) { - locals[key] = angular.isString(value) ? $injector.get(value) : $injector.invoke(value); + locals[key] = angular.isString(value) ? + $injector.get(value) : $injector.invoke(value); }); if (angular.isDefined(template = next.template)) { |
