Update bower dependencies.
This commit is contained in:
parent
818bdad5af
commit
2beab45f32
185 changed files with 21480 additions and 8110 deletions
12
app/bower_components/angular-route/.bower.json
vendored
12
app/bower_components/angular-route/.bower.json
vendored
|
@ -1,20 +1,20 @@
|
|||
{
|
||||
"name": "angular-route",
|
||||
"version": "1.5.11",
|
||||
"version": "1.7.8",
|
||||
"license": "MIT",
|
||||
"main": "./angular-route.js",
|
||||
"ignore": [],
|
||||
"dependencies": {
|
||||
"angular": "1.5.11"
|
||||
"angular": "1.7.8"
|
||||
},
|
||||
"homepage": "https://github.com/angular/bower-angular-route",
|
||||
"_release": "1.5.11",
|
||||
"_release": "1.7.8",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.5.11",
|
||||
"commit": "cdb9db456ece8b3f80a638bb7bd69dc2dcd4eee9"
|
||||
"tag": "v1.7.8",
|
||||
"commit": "3d3b033f45993827dc587474a18649092391d251"
|
||||
},
|
||||
"_source": "https://github.com/angular/bower-angular-route.git",
|
||||
"_target": "1.5.11",
|
||||
"_target": "1.7.8",
|
||||
"_originalSource": "angular-route"
|
||||
}
|
413
app/bower_components/angular-route/angular-route.js
vendored
413
app/bower_components/angular-route/angular-route.js
vendored
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* @license AngularJS v1.5.11
|
||||
* (c) 2010-2017 Google, Inc. http://angularjs.org
|
||||
* @license AngularJS v1.7.8
|
||||
* (c) 2010-2018 Google, Inc. http://angularjs.org
|
||||
* License: MIT
|
||||
*/
|
||||
(function(window, angular) {'use strict';
|
||||
|
@ -32,32 +32,84 @@ function shallowCopy(src, dst) {
|
|||
return dst || src;
|
||||
}
|
||||
|
||||
/* global routeToRegExp: true */
|
||||
|
||||
/**
|
||||
* @param {string} path - The path to parse. (It is assumed to have query and hash stripped off.)
|
||||
* @param {Object} opts - Options.
|
||||
* @return {Object} - An object containing an array of path parameter names (`keys`) and a regular
|
||||
* expression (`regexp`) that can be used to identify a matching URL and extract the path
|
||||
* parameter values.
|
||||
*
|
||||
* @description
|
||||
* Parses the given path, extracting path parameter names and a regular expression to match URLs.
|
||||
*
|
||||
* Originally inspired by `pathRexp` in `visionmedia/express/lib/utils.js`.
|
||||
*/
|
||||
function routeToRegExp(path, opts) {
|
||||
var keys = [];
|
||||
|
||||
var pattern = path
|
||||
.replace(/([().])/g, '\\$1')
|
||||
.replace(/(\/)?:(\w+)(\*\?|[?*])?/g, function(_, slash, key, option) {
|
||||
var optional = option === '?' || option === '*?';
|
||||
var star = option === '*' || option === '*?';
|
||||
keys.push({name: key, optional: optional});
|
||||
slash = slash || '';
|
||||
return (
|
||||
(optional ? '(?:' + slash : slash + '(?:') +
|
||||
(star ? '(.+?)' : '([^/]+)') +
|
||||
(optional ? '?)?' : ')')
|
||||
);
|
||||
})
|
||||
.replace(/([/$*])/g, '\\$1');
|
||||
|
||||
if (opts.ignoreTrailingSlashes) {
|
||||
pattern = pattern.replace(/\/+$/, '') + '/*';
|
||||
}
|
||||
|
||||
return {
|
||||
keys: keys,
|
||||
regexp: new RegExp(
|
||||
'^' + pattern + '(?:[?#]|$)',
|
||||
opts.caseInsensitiveMatch ? 'i' : ''
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
/* global routeToRegExp: false */
|
||||
/* global shallowCopy: false */
|
||||
|
||||
// There are necessary for `shallowCopy()` (included via `src/shallowCopy.js`).
|
||||
// `isArray` and `isObject` are necessary for `shallowCopy()` (included via `src/shallowCopy.js`).
|
||||
// They are initialized inside the `$RouteProvider`, to ensure `window.angular` is available.
|
||||
var isArray;
|
||||
var isObject;
|
||||
var isDefined;
|
||||
var noop;
|
||||
|
||||
/**
|
||||
* @ngdoc module
|
||||
* @name ngRoute
|
||||
* @description
|
||||
*
|
||||
* # ngRoute
|
||||
*
|
||||
* The `ngRoute` module provides routing and deeplinking services and directives for angular apps.
|
||||
* The `ngRoute` module provides routing and deeplinking services and directives for AngularJS apps.
|
||||
*
|
||||
* ## Example
|
||||
* See {@link ngRoute.$route#example $route} for an example of configuring and using `ngRoute`.
|
||||
* See {@link ngRoute.$route#examples $route} for an example of configuring and using `ngRoute`.
|
||||
*
|
||||
*
|
||||
* <div doc-module-components="ngRoute"></div>
|
||||
*/
|
||||
/* global -ngRouteModule */
|
||||
var ngRouteModule = angular.module('ngRoute', ['ng']).
|
||||
provider('$route', $RouteProvider),
|
||||
$routeMinErr = angular.$$minErr('ngRoute');
|
||||
/* global -ngRouteModule */
|
||||
var ngRouteModule = angular.
|
||||
module('ngRoute', []).
|
||||
info({ angularVersion: '1.7.8' }).
|
||||
provider('$route', $RouteProvider).
|
||||
// Ensure `$route` will be instantiated in time to capture the initial `$locationChangeSuccess`
|
||||
// event (unless explicitly disabled). This is necessary in case `ngView` is included in an
|
||||
// asynchronously loaded template.
|
||||
run(instantiateRoute);
|
||||
var $routeMinErr = angular.$$minErr('ngRoute');
|
||||
var isEagerInstantiationEnabled;
|
||||
|
||||
|
||||
/**
|
||||
* @ngdoc provider
|
||||
|
@ -69,7 +121,7 @@ var ngRouteModule = angular.module('ngRoute', ['ng']).
|
|||
* Used for configuring routes.
|
||||
*
|
||||
* ## Example
|
||||
* See {@link ngRoute.$route#example $route} for an example of configuring and using `ngRoute`.
|
||||
* See {@link ngRoute.$route#examples $route} for an example of configuring and using `ngRoute`.
|
||||
*
|
||||
* ## Dependencies
|
||||
* Requires the {@link ngRoute `ngRoute`} module to be installed.
|
||||
|
@ -77,6 +129,8 @@ var ngRouteModule = angular.module('ngRoute', ['ng']).
|
|||
function $RouteProvider() {
|
||||
isArray = angular.isArray;
|
||||
isObject = angular.isObject;
|
||||
isDefined = angular.isDefined;
|
||||
noop = angular.noop;
|
||||
|
||||
function inherit(parent, extra) {
|
||||
return angular.extend(Object.create(parent), extra);
|
||||
|
@ -113,12 +167,12 @@ function $RouteProvider() {
|
|||
*
|
||||
* Object properties:
|
||||
*
|
||||
* - `controller` – `{(string|function()=}` – Controller fn that should be associated with
|
||||
* - `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=}` – An identifier name for a reference to the controller.
|
||||
* 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
|
||||
* - `template` – `{(string|Function)=}` – html template as a string or a function that
|
||||
* returns an html template as a string which should be used by {@link
|
||||
* ngRoute.directive:ngView ngView} or {@link ng.directive:ngInclude ngInclude} directives.
|
||||
* This property takes precedence over `templateUrl`.
|
||||
|
@ -128,7 +182,9 @@ function $RouteProvider() {
|
|||
* - `{Array.<Object>}` - route parameters extracted from the current
|
||||
* `$location.path()` by applying the current route
|
||||
*
|
||||
* - `templateUrl` – `{string=|function()=}` – path or function that returns a path to an html
|
||||
* One of `template` or `templateUrl` is required.
|
||||
*
|
||||
* - `templateUrl` – `{(string|Function)=}` – path or function that returns a path to an html
|
||||
* template that should be used by {@link ngRoute.directive:ngView ngView}.
|
||||
*
|
||||
* If `templateUrl` is a function, it will be called with the following parameters:
|
||||
|
@ -136,7 +192,9 @@ function $RouteProvider() {
|
|||
* - `{Array.<Object>}` - route parameters extracted from the current
|
||||
* `$location.path()` by applying the current route
|
||||
*
|
||||
* - `resolve` - `{Object.<string, function>=}` - An optional map of dependencies which should
|
||||
* One of `templateUrl` or `template` is required.
|
||||
*
|
||||
* - `resolve` - `{Object.<string, Function>=}` - An optional map of dependencies which should
|
||||
* be injected into the controller. If any of these dependencies are promises, the router
|
||||
* will wait for them all to be resolved or one to be rejected before the controller is
|
||||
* instantiated.
|
||||
|
@ -156,7 +214,7 @@ function $RouteProvider() {
|
|||
* 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.
|
||||
* - `factory` - `{string|Function}`: If `string` then it is an alias for a service.
|
||||
* Otherwise if function, then it is {@link 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
|
||||
|
@ -166,7 +224,7 @@ function $RouteProvider() {
|
|||
* - `resolveAs` - `{string=}` - The name under which the `resolve` map will be available on
|
||||
* the scope of the route. If omitted, defaults to `$resolve`.
|
||||
*
|
||||
* - `redirectTo` – `{(string|function())=}` – value to update
|
||||
* - `redirectTo` – `{(string|Function)=}` – value to update
|
||||
* {@link ng.$location $location} path with and trigger route redirection.
|
||||
*
|
||||
* If `redirectTo` is a function, it will be called with the following parameters:
|
||||
|
@ -177,13 +235,48 @@ function $RouteProvider() {
|
|||
* - `{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()`.
|
||||
* to update `$location.url()`. If the function throws an error, no further processing will
|
||||
* take place and the {@link ngRoute.$route#$routeChangeError $routeChangeError} event will
|
||||
* be fired.
|
||||
*
|
||||
* Routes that specify `redirectTo` will not have their controllers, template functions
|
||||
* or resolves called, the `$location` will be changed to the redirect url and route
|
||||
* processing will stop. The exception to this is if the `redirectTo` is a function that
|
||||
* returns `undefined`. In this case the route transition occurs as though there was no
|
||||
* redirection.
|
||||
*
|
||||
* - `resolveRedirectTo` – `{Function=}` – a function that will (eventually) return the value
|
||||
* to update {@link ng.$location $location} URL with and trigger route redirection. In
|
||||
* contrast to `redirectTo`, dependencies can be injected into `resolveRedirectTo` and the
|
||||
* return value can be either a string or a promise that will be resolved to a string.
|
||||
*
|
||||
* Similar to `redirectTo`, if the return value is `undefined` (or a promise that gets
|
||||
* resolved to `undefined`), no redirection takes place and the route transition occurs as
|
||||
* though there was no redirection.
|
||||
*
|
||||
* If the function throws an error or the returned promise gets rejected, no further
|
||||
* processing will take place and the
|
||||
* {@link ngRoute.$route#$routeChangeError $routeChangeError} event will be fired.
|
||||
*
|
||||
* `redirectTo` takes precedence over `resolveRedirectTo`, so specifying both on the same
|
||||
* route definition, will cause the latter to be ignored.
|
||||
*
|
||||
* - `[reloadOnUrl=true]` - `{boolean=}` - reload route when any part of the URL changes
|
||||
* (including the path) even if the new URL maps to the same route.
|
||||
*
|
||||
* If the option is set to `false` and the URL in the browser changes, but the new URL maps
|
||||
* to the same route, then a `$routeUpdate` event is broadcasted on the root scope (without
|
||||
* reloading the route).
|
||||
*
|
||||
* - `[reloadOnSearch=true]` - `{boolean=}` - reload route when only `$location.search()`
|
||||
* or `$location.hash()` changes.
|
||||
*
|
||||
* If the option is set to `false` and url in the browser changes, then
|
||||
* `$routeUpdate` event is broadcasted on the root scope.
|
||||
* If the option is set to `false` and the URL in the browser changes, then a `$routeUpdate`
|
||||
* event is broadcasted on the root scope (without reloading the route).
|
||||
*
|
||||
* <div class="alert alert-warning">
|
||||
* **Note:** This option has no effect if `reloadOnUrl` is set to `false`.
|
||||
* </div>
|
||||
*
|
||||
* - `[caseInsensitiveMatch=false]` - `{boolean=}` - match routes without being case sensitive
|
||||
*
|
||||
|
@ -198,6 +291,9 @@ function $RouteProvider() {
|
|||
this.when = function(path, route) {
|
||||
//copy original route object to preserve params inherited from proto chain
|
||||
var routeCopy = shallowCopy(route);
|
||||
if (angular.isUndefined(routeCopy.reloadOnUrl)) {
|
||||
routeCopy.reloadOnUrl = true;
|
||||
}
|
||||
if (angular.isUndefined(routeCopy.reloadOnSearch)) {
|
||||
routeCopy.reloadOnSearch = true;
|
||||
}
|
||||
|
@ -206,7 +302,8 @@ function $RouteProvider() {
|
|||
}
|
||||
routes[path] = angular.extend(
|
||||
routeCopy,
|
||||
path && pathRegExp(path, routeCopy)
|
||||
{originalPath: path},
|
||||
path && routeToRegExp(path, routeCopy)
|
||||
);
|
||||
|
||||
// create redirection for trailing slashes
|
||||
|
@ -216,8 +313,8 @@ function $RouteProvider() {
|
|||
: path + '/';
|
||||
|
||||
routes[redirectPath] = angular.extend(
|
||||
{redirectTo: path},
|
||||
pathRegExp(redirectPath, routeCopy)
|
||||
{originalPath: path, redirectTo: path},
|
||||
routeToRegExp(redirectPath, routeCopy)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -235,47 +332,6 @@ function $RouteProvider() {
|
|||
*/
|
||||
this.caseInsensitiveMatch = false;
|
||||
|
||||
/**
|
||||
* @param path {string} path
|
||||
* @param opts {Object} options
|
||||
* @return {?Object}
|
||||
*
|
||||
* @description
|
||||
* Normalizes the given path, returning a regular expression
|
||||
* and the original path.
|
||||
*
|
||||
* Inspired by pathRexp in visionmedia/express/lib/utils.js.
|
||||
*/
|
||||
function pathRegExp(path, opts) {
|
||||
var insensitive = opts.caseInsensitiveMatch,
|
||||
ret = {
|
||||
originalPath: path,
|
||||
regexp: path
|
||||
},
|
||||
keys = ret.keys = [];
|
||||
|
||||
path = path
|
||||
.replace(/([().])/g, '\\$1')
|
||||
.replace(/(\/)?:(\w+)(\*\?|[?*])?/g, function(_, slash, key, option) {
|
||||
var optional = (option === '?' || option === '*?') ? '?' : null;
|
||||
var star = (option === '*' || option === '*?') ? '*' : null;
|
||||
keys.push({ name: key, optional: !!optional });
|
||||
slash = slash || '';
|
||||
return ''
|
||||
+ (optional ? '' : slash)
|
||||
+ '(?:'
|
||||
+ (optional ? slash : '')
|
||||
+ (star && '(.+?)' || '([^/]+)')
|
||||
+ (optional || '')
|
||||
+ ')'
|
||||
+ (optional || '');
|
||||
})
|
||||
.replace(/([/$*])/g, '\\$1');
|
||||
|
||||
ret.regexp = new RegExp('^' + path + '$', insensitive ? 'i' : '');
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name $routeProvider#otherwise
|
||||
|
@ -296,6 +352,47 @@ function $RouteProvider() {
|
|||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name $routeProvider#eagerInstantiationEnabled
|
||||
* @kind function
|
||||
*
|
||||
* @description
|
||||
* Call this method as a setter to enable/disable eager instantiation of the
|
||||
* {@link ngRoute.$route $route} service upon application bootstrap. You can also call it as a
|
||||
* getter (i.e. without any arguments) to get the current value of the
|
||||
* `eagerInstantiationEnabled` flag.
|
||||
*
|
||||
* Instantiating `$route` early is necessary for capturing the initial
|
||||
* {@link ng.$location#$locationChangeStart $locationChangeStart} event and navigating to the
|
||||
* appropriate route. Usually, `$route` is instantiated in time by the
|
||||
* {@link ngRoute.ngView ngView} directive. Yet, in cases where `ngView` is included in an
|
||||
* asynchronously loaded template (e.g. in another directive's template), the directive factory
|
||||
* might not be called soon enough for `$route` to be instantiated _before_ the initial
|
||||
* `$locationChangeSuccess` event is fired. Eager instantiation ensures that `$route` is always
|
||||
* instantiated in time, regardless of when `ngView` will be loaded.
|
||||
*
|
||||
* The default value is true.
|
||||
*
|
||||
* **Note**:<br />
|
||||
* You may want to disable the default behavior when unit-testing modules that depend on
|
||||
* `ngRoute`, in order to avoid an unexpected request for the default route's template.
|
||||
*
|
||||
* @param {boolean=} enabled - If provided, update the internal `eagerInstantiationEnabled` flag.
|
||||
*
|
||||
* @returns {*} The current value of the `eagerInstantiationEnabled` flag if used as a getter or
|
||||
* itself (for chaining) if used as a setter.
|
||||
*/
|
||||
isEagerInstantiationEnabled = true;
|
||||
this.eagerInstantiationEnabled = function eagerInstantiationEnabled(enabled) {
|
||||
if (isDefined(enabled)) {
|
||||
isEagerInstantiationEnabled = enabled;
|
||||
return this;
|
||||
}
|
||||
|
||||
return isEagerInstantiationEnabled;
|
||||
};
|
||||
|
||||
|
||||
this.$get = ['$rootScope',
|
||||
'$location',
|
||||
|
@ -304,7 +401,8 @@ function $RouteProvider() {
|
|||
'$injector',
|
||||
'$templateRequest',
|
||||
'$sce',
|
||||
function($rootScope, $location, $routeParams, $q, $injector, $templateRequest, $sce) {
|
||||
'$browser',
|
||||
function($rootScope, $location, $routeParams, $q, $injector, $templateRequest, $sce, $browser) {
|
||||
|
||||
/**
|
||||
* @ngdoc service
|
||||
|
@ -483,12 +581,14 @@ function $RouteProvider() {
|
|||
* @name $route#$routeChangeError
|
||||
* @eventType broadcast on root scope
|
||||
* @description
|
||||
* Broadcasted if any of the resolve promises are rejected.
|
||||
* Broadcasted if a redirection function fails or any redirection or resolve promises are
|
||||
* rejected.
|
||||
*
|
||||
* @param {Object} angularEvent Synthetic event object
|
||||
* @param {Route} current Current route information.
|
||||
* @param {Route} previous Previous route information.
|
||||
* @param {Route} rejection Rejection of the promise. Usually the error of the failed promise.
|
||||
* @param {Route} rejection The thrown error or the rejection reason of the promise. Usually
|
||||
* the rejection reason is the error that caused the promise to get rejected.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -496,8 +596,9 @@ function $RouteProvider() {
|
|||
* @name $route#$routeUpdate
|
||||
* @eventType broadcast on root scope
|
||||
* @description
|
||||
* The `reloadOnSearch` property has been set to false, and we are reusing the same
|
||||
* instance of the Controller.
|
||||
* Broadcasted if the same instance of a route (including template, controller instance,
|
||||
* resolved dependencies, etc.) is being reused. This can happen if either `reloadOnSearch` or
|
||||
* `reloadOnUrl` has been set to `false`.
|
||||
*
|
||||
* @param {Object} angularEvent Synthetic event object
|
||||
* @param {Route} current Current/previous route information.
|
||||
|
@ -557,7 +658,7 @@ function $RouteProvider() {
|
|||
// interpolate modifies newParams, only query params are left
|
||||
$location.search(newParams);
|
||||
} else {
|
||||
throw $routeMinErr('norout', 'Tried updating route when with no current route');
|
||||
throw $routeMinErr('norout', 'Tried updating route with no current route');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -605,9 +706,7 @@ function $RouteProvider() {
|
|||
var lastRoute = $route.current;
|
||||
|
||||
preparedRoute = parseRoute();
|
||||
preparedRouteIsUpdateOnly = preparedRoute && lastRoute && preparedRoute.$$route === lastRoute.$$route
|
||||
&& angular.equals(preparedRoute.pathParams, lastRoute.pathParams)
|
||||
&& !preparedRoute.reloadOnSearch && !forceReload;
|
||||
preparedRouteIsUpdateOnly = isNavigationUpdateOnly(preparedRoute, lastRoute);
|
||||
|
||||
if (!preparedRouteIsUpdateOnly && (lastRoute || preparedRoute)) {
|
||||
if ($rootScope.$broadcast('$routeChangeStart', preparedRoute, lastRoute).defaultPrevented) {
|
||||
|
@ -629,37 +728,112 @@ function $RouteProvider() {
|
|||
} else if (nextRoute || lastRoute) {
|
||||
forceReload = false;
|
||||
$route.current = nextRoute;
|
||||
if (nextRoute) {
|
||||
if (nextRoute.redirectTo) {
|
||||
if (angular.isString(nextRoute.redirectTo)) {
|
||||
$location.path(interpolate(nextRoute.redirectTo, nextRoute.params)).search(nextRoute.params)
|
||||
.replace();
|
||||
} else {
|
||||
$location.url(nextRoute.redirectTo(nextRoute.pathParams, $location.path(), $location.search()))
|
||||
.replace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$q.when(nextRoute).
|
||||
then(resolveLocals).
|
||||
then(function(locals) {
|
||||
// after route change
|
||||
if (nextRoute === $route.current) {
|
||||
if (nextRoute) {
|
||||
nextRoute.locals = locals;
|
||||
angular.copy(nextRoute.params, $routeParams);
|
||||
}
|
||||
$rootScope.$broadcast('$routeChangeSuccess', nextRoute, lastRoute);
|
||||
}
|
||||
}, function(error) {
|
||||
var nextRoutePromise = $q.resolve(nextRoute);
|
||||
|
||||
$browser.$$incOutstandingRequestCount('$route');
|
||||
|
||||
nextRoutePromise.
|
||||
then(getRedirectionData).
|
||||
then(handlePossibleRedirection).
|
||||
then(function(keepProcessingRoute) {
|
||||
return keepProcessingRoute && nextRoutePromise.
|
||||
then(resolveLocals).
|
||||
then(function(locals) {
|
||||
// after route change
|
||||
if (nextRoute === $route.current) {
|
||||
if (nextRoute) {
|
||||
nextRoute.locals = locals;
|
||||
angular.copy(nextRoute.params, $routeParams);
|
||||
}
|
||||
$rootScope.$broadcast('$routeChangeSuccess', nextRoute, lastRoute);
|
||||
}
|
||||
});
|
||||
}).catch(function(error) {
|
||||
if (nextRoute === $route.current) {
|
||||
$rootScope.$broadcast('$routeChangeError', nextRoute, lastRoute, error);
|
||||
}
|
||||
}).finally(function() {
|
||||
// Because `commitRoute()` is called from a `$rootScope.$evalAsync` block (see
|
||||
// `$locationWatch`), this `$$completeOutstandingRequest()` call will not cause
|
||||
// `outstandingRequestCount` to hit zero. This is important in case we are redirecting
|
||||
// to a new route which also requires some asynchronous work.
|
||||
|
||||
$browser.$$completeOutstandingRequest(noop, '$route');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function getRedirectionData(route) {
|
||||
var data = {
|
||||
route: route,
|
||||
hasRedirection: false
|
||||
};
|
||||
|
||||
if (route) {
|
||||
if (route.redirectTo) {
|
||||
if (angular.isString(route.redirectTo)) {
|
||||
data.path = interpolate(route.redirectTo, route.params);
|
||||
data.search = route.params;
|
||||
data.hasRedirection = true;
|
||||
} else {
|
||||
var oldPath = $location.path();
|
||||
var oldSearch = $location.search();
|
||||
var newUrl = route.redirectTo(route.pathParams, oldPath, oldSearch);
|
||||
|
||||
if (angular.isDefined(newUrl)) {
|
||||
data.url = newUrl;
|
||||
data.hasRedirection = true;
|
||||
}
|
||||
}
|
||||
} else if (route.resolveRedirectTo) {
|
||||
return $q.
|
||||
resolve($injector.invoke(route.resolveRedirectTo)).
|
||||
then(function(newUrl) {
|
||||
if (angular.isDefined(newUrl)) {
|
||||
data.url = newUrl;
|
||||
data.hasRedirection = true;
|
||||
}
|
||||
|
||||
return data;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function handlePossibleRedirection(data) {
|
||||
var keepProcessingRoute = true;
|
||||
|
||||
if (data.route !== $route.current) {
|
||||
keepProcessingRoute = false;
|
||||
} else if (data.hasRedirection) {
|
||||
var oldUrl = $location.url();
|
||||
var newUrl = data.url;
|
||||
|
||||
if (newUrl) {
|
||||
$location.
|
||||
url(newUrl).
|
||||
replace();
|
||||
} else {
|
||||
newUrl = $location.
|
||||
path(data.path).
|
||||
search(data.search).
|
||||
replace().
|
||||
url();
|
||||
}
|
||||
|
||||
if (newUrl !== oldUrl) {
|
||||
// Exit out and don't process current next value,
|
||||
// wait for next location change from redirect
|
||||
keepProcessingRoute = false;
|
||||
}
|
||||
}
|
||||
|
||||
return keepProcessingRoute;
|
||||
}
|
||||
|
||||
function resolveLocals(route) {
|
||||
if (route) {
|
||||
var locals = angular.extend({}, route.resolve);
|
||||
|
@ -676,7 +850,6 @@ function $RouteProvider() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
function getTemplateFor(route) {
|
||||
var template, templateUrl;
|
||||
if (angular.isDefined(template = route.template)) {
|
||||
|
@ -695,7 +868,6 @@ function $RouteProvider() {
|
|||
return template;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @returns {Object} the current active route, by matching it against the URL
|
||||
*/
|
||||
|
@ -714,6 +886,29 @@ function $RouteProvider() {
|
|||
return match || routes[null] && inherit(routes[null], {params: {}, pathParams:{}});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Object} newRoute - The new route configuration (as returned by `parseRoute()`).
|
||||
* @param {Object} oldRoute - The previous route configuration (as returned by `parseRoute()`).
|
||||
* @returns {boolean} Whether this is an "update-only" navigation, i.e. the URL maps to the same
|
||||
* route and it can be reused (based on the config and the type of change).
|
||||
*/
|
||||
function isNavigationUpdateOnly(newRoute, oldRoute) {
|
||||
// IF this is not a forced reload
|
||||
return !forceReload
|
||||
// AND both `newRoute`/`oldRoute` are defined
|
||||
&& newRoute && oldRoute
|
||||
// AND they map to the same Route Definition Object
|
||||
&& (newRoute.$$route === oldRoute.$$route)
|
||||
// AND `reloadOnUrl` is disabled
|
||||
&& (!newRoute.reloadOnUrl
|
||||
// OR `reloadOnSearch` is disabled
|
||||
|| (!newRoute.reloadOnSearch
|
||||
// AND both routes have the same path params
|
||||
&& angular.equals(newRoute.pathParams, oldRoute.pathParams)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {string} interpolation of the redirect path with the parameters
|
||||
*/
|
||||
|
@ -735,6 +930,14 @@ function $RouteProvider() {
|
|||
}];
|
||||
}
|
||||
|
||||
instantiateRoute.$inject = ['$injector'];
|
||||
function instantiateRoute($injector) {
|
||||
if (isEagerInstantiationEnabled) {
|
||||
// Instantiate `$route`
|
||||
$injector.get('$route');
|
||||
}
|
||||
}
|
||||
|
||||
ngRouteModule.provider('$routeParams', $RouteParamsProvider);
|
||||
|
||||
|
||||
|
@ -786,7 +989,6 @@ ngRouteModule.directive('ngView', ngViewFillContentFactory);
|
|||
* @restrict ECA
|
||||
*
|
||||
* @description
|
||||
* # Overview
|
||||
* `ngView` is a directive that complements the {@link ngRoute.$route $route} service by
|
||||
* including the rendered template of the current route into the main layout (`index.html`) file.
|
||||
* Every time the current route changes, the included view changes with it according to the
|
||||
|
@ -802,13 +1004,6 @@ ngRouteModule.directive('ngView', ngViewFillContentFactory);
|
|||
*
|
||||
* The enter and leave animation occur concurrently.
|
||||
*
|
||||
* @knownIssue If `ngView` is contained in an asynchronously loaded template (e.g. in another
|
||||
* directive's templateUrl or in a template loaded using `ngInclude`), then you need to
|
||||
* make sure that `$route` is instantiated in time to capture the initial
|
||||
* `$locationChangeStart` event and load the appropriate view. One way to achieve this
|
||||
* is to have it as a dependency in a `.run` block:
|
||||
* `myModule.run(['$route', function() {}]);`
|
||||
*
|
||||
* @scope
|
||||
* @priority 400
|
||||
* @param {string=} onload Expression to evaluate whenever the view updates.
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
/*
|
||||
AngularJS v1.5.11
|
||||
(c) 2010-2017 Google, Inc. http://angularjs.org
|
||||
AngularJS v1.7.8
|
||||
(c) 2010-2018 Google, Inc. http://angularjs.org
|
||||
License: MIT
|
||||
*/
|
||||
(function(E,d){'use strict';function y(t,l,g){return{restrict:"ECA",terminal:!0,priority:400,transclude:"element",link:function(b,e,a,c,k){function p(){m&&(g.cancel(m),m=null);h&&(h.$destroy(),h=null);n&&(m=g.leave(n),m.done(function(b){!1!==b&&(m=null)}),n=null)}function B(){var a=t.current&&t.current.locals;if(d.isDefined(a&&a.$template)){var a=b.$new(),c=t.current;n=k(a,function(a){g.enter(a,null,n||e).done(function(a){!1===a||!d.isDefined(A)||A&&!b.$eval(A)||l()});p()});h=c.scope=a;h.$emit("$viewContentLoaded");
|
||||
h.$eval(s)}else p()}var h,n,m,A=a.autoscroll,s=a.onload||"";b.$on("$routeChangeSuccess",B);B()}}}function w(d,l,g){return{restrict:"ECA",priority:-400,link:function(b,e){var a=g.current,c=a.locals;e.html(c.$template);var k=d(e.contents());if(a.controller){c.$scope=b;var p=l(a.controller,c);a.controllerAs&&(b[a.controllerAs]=p);e.data("$ngControllerController",p);e.children().data("$ngControllerController",p)}b[a.resolveAs||"$resolve"]=c;k(b)}}}var x,C,s=d.module("ngRoute",["ng"]).provider("$route",
|
||||
function(){function t(b,e){return d.extend(Object.create(b),e)}function l(b,d){var a=d.caseInsensitiveMatch,c={originalPath:b,regexp:b},g=c.keys=[];b=b.replace(/([().])/g,"\\$1").replace(/(\/)?:(\w+)(\*\?|[?*])?/g,function(b,a,d,c){b="?"===c||"*?"===c?"?":null;c="*"===c||"*?"===c?"*":null;g.push({name:d,optional:!!b});a=a||"";return""+(b?"":a)+"(?:"+(b?a:"")+(c&&"(.+?)"||"([^/]+)")+(b||"")+")"+(b||"")}).replace(/([/$*])/g,"\\$1");c.regexp=new RegExp("^"+b+"$",a?"i":"");return c}x=d.isArray;C=d.isObject;
|
||||
var g={};this.when=function(b,e){var a;a=void 0;if(x(e)){a=a||[];for(var c=0,k=e.length;c<k;c++)a[c]=e[c]}else if(C(e))for(c in a=a||{},e)if("$"!==c.charAt(0)||"$"!==c.charAt(1))a[c]=e[c];a=a||e;d.isUndefined(a.reloadOnSearch)&&(a.reloadOnSearch=!0);d.isUndefined(a.caseInsensitiveMatch)&&(a.caseInsensitiveMatch=this.caseInsensitiveMatch);g[b]=d.extend(a,b&&l(b,a));b&&(c="/"===b[b.length-1]?b.substr(0,b.length-1):b+"/",g[c]=d.extend({redirectTo:b},l(c,a)));return this};this.caseInsensitiveMatch=!1;
|
||||
this.otherwise=function(b){"string"===typeof b&&(b={redirectTo:b});this.when(null,b);return this};this.$get=["$rootScope","$location","$routeParams","$q","$injector","$templateRequest","$sce",function(b,e,a,c,k,p,l){function h(a){var f=v.current;(x=(r=y())&&f&&r.$$route===f.$$route&&d.equals(r.pathParams,f.pathParams)&&!r.reloadOnSearch&&!z)||!f&&!r||b.$broadcast("$routeChangeStart",r,f).defaultPrevented&&a&&a.preventDefault()}function n(){var u=v.current,f=r;if(x)u.params=f.params,d.copy(u.params,
|
||||
a),b.$broadcast("$routeUpdate",u);else if(f||u)z=!1,(v.current=f)&&f.redirectTo&&(d.isString(f.redirectTo)?e.path(w(f.redirectTo,f.params)).search(f.params).replace():e.url(f.redirectTo(f.pathParams,e.path(),e.search())).replace()),c.when(f).then(m).then(function(c){f===v.current&&(f&&(f.locals=c,d.copy(f.params,a)),b.$broadcast("$routeChangeSuccess",f,u))},function(a){f===v.current&&b.$broadcast("$routeChangeError",f,u,a)})}function m(a){if(a){var b=d.extend({},a.resolve);d.forEach(b,function(a,
|
||||
c){b[c]=d.isString(a)?k.get(a):k.invoke(a,null,null,c)});a=s(a);d.isDefined(a)&&(b.$template=a);return c.all(b)}}function s(a){var b,c;d.isDefined(b=a.template)?d.isFunction(b)&&(b=b(a.params)):d.isDefined(c=a.templateUrl)&&(d.isFunction(c)&&(c=c(a.params)),d.isDefined(c)&&(a.loadedTemplateUrl=l.valueOf(c),b=p(c)));return b}function y(){var a,b;d.forEach(g,function(c,g){var q;if(q=!b){var h=e.path();q=c.keys;var l={};if(c.regexp)if(h=c.regexp.exec(h)){for(var k=1,p=h.length;k<p;++k){var m=q[k-1],
|
||||
n=h[k];m&&n&&(l[m.name]=n)}q=l}else q=null;else q=null;q=a=q}q&&(b=t(c,{params:d.extend({},e.search(),a),pathParams:a}),b.$$route=c)});return b||g[null]&&t(g[null],{params:{},pathParams:{}})}function w(a,b){var c=[];d.forEach((a||"").split(":"),function(a,d){if(0===d)c.push(a);else{var e=a.match(/(\w+)(?:[?*])?(.*)/),g=e[1];c.push(b[g]);c.push(e[2]||"");delete b[g]}});return c.join("")}var z=!1,r,x,v={routes:g,reload:function(){z=!0;var a={defaultPrevented:!1,preventDefault:function(){this.defaultPrevented=
|
||||
!0;z=!1}};b.$evalAsync(function(){h(a);a.defaultPrevented||n()})},updateParams:function(a){if(this.current&&this.current.$$route)a=d.extend({},this.current.params,a),e.path(w(this.current.$$route.originalPath,a)),e.search(a);else throw D("norout");}};b.$on("$locationChangeStart",h);b.$on("$locationChangeSuccess",n);return v}]}),D=d.$$minErr("ngRoute");s.provider("$routeParams",function(){this.$get=function(){return{}}});s.directive("ngView",y);s.directive("ngView",w);y.$inject=["$route","$anchorScroll",
|
||||
"$animate"];w.$inject=["$compile","$controller","$route"]})(window,window.angular);
|
||||
(function(I,b){'use strict';function z(b,h){var d=[],c=b.replace(/([().])/g,"\\$1").replace(/(\/)?:(\w+)(\*\?|[?*])?/g,function(b,c,h,k){b="?"===k||"*?"===k;k="*"===k||"*?"===k;d.push({name:h,optional:b});c=c||"";return(b?"(?:"+c:c+"(?:")+(k?"(.+?)":"([^/]+)")+(b?"?)?":")")}).replace(/([/$*])/g,"\\$1");h.ignoreTrailingSlashes&&(c=c.replace(/\/+$/,"")+"/*");return{keys:d,regexp:new RegExp("^"+c+"(?:[?#]|$)",h.caseInsensitiveMatch?"i":"")}}function A(b){p&&b.get("$route")}function v(u,h,d){return{restrict:"ECA",
|
||||
terminal:!0,priority:400,transclude:"element",link:function(c,f,g,l,k){function q(){r&&(d.cancel(r),r=null);m&&(m.$destroy(),m=null);s&&(r=d.leave(s),r.done(function(b){!1!==b&&(r=null)}),s=null)}function C(){var g=u.current&&u.current.locals;if(b.isDefined(g&&g.$template)){var g=c.$new(),l=u.current;s=k(g,function(g){d.enter(g,null,s||f).done(function(d){!1===d||!b.isDefined(w)||w&&!c.$eval(w)||h()});q()});m=l.scope=g;m.$emit("$viewContentLoaded");m.$eval(p)}else q()}var m,s,r,w=g.autoscroll,p=g.onload||
|
||||
"";c.$on("$routeChangeSuccess",C);C()}}}function x(b,h,d){return{restrict:"ECA",priority:-400,link:function(c,f){var g=d.current,l=g.locals;f.html(l.$template);var k=b(f.contents());if(g.controller){l.$scope=c;var q=h(g.controller,l);g.controllerAs&&(c[g.controllerAs]=q);f.data("$ngControllerController",q);f.children().data("$ngControllerController",q)}c[g.resolveAs||"$resolve"]=l;k(c)}}}var D,E,F,G,y=b.module("ngRoute",[]).info({angularVersion:"1.7.8"}).provider("$route",function(){function u(d,
|
||||
c){return b.extend(Object.create(d),c)}D=b.isArray;E=b.isObject;F=b.isDefined;G=b.noop;var h={};this.when=function(d,c){var f;f=void 0;if(D(c)){f=f||[];for(var g=0,l=c.length;g<l;g++)f[g]=c[g]}else if(E(c))for(g in f=f||{},c)if("$"!==g.charAt(0)||"$"!==g.charAt(1))f[g]=c[g];f=f||c;b.isUndefined(f.reloadOnUrl)&&(f.reloadOnUrl=!0);b.isUndefined(f.reloadOnSearch)&&(f.reloadOnSearch=!0);b.isUndefined(f.caseInsensitiveMatch)&&(f.caseInsensitiveMatch=this.caseInsensitiveMatch);h[d]=b.extend(f,{originalPath:d},
|
||||
d&&z(d,f));d&&(g="/"===d[d.length-1]?d.substr(0,d.length-1):d+"/",h[g]=b.extend({originalPath:d,redirectTo:d},z(g,f)));return this};this.caseInsensitiveMatch=!1;this.otherwise=function(b){"string"===typeof b&&(b={redirectTo:b});this.when(null,b);return this};p=!0;this.eagerInstantiationEnabled=function(b){return F(b)?(p=b,this):p};this.$get=["$rootScope","$location","$routeParams","$q","$injector","$templateRequest","$sce","$browser",function(d,c,f,g,l,k,q,p){function m(a){var e=t.current;n=A();(x=
|
||||
!B&&n&&e&&n.$$route===e.$$route&&(!n.reloadOnUrl||!n.reloadOnSearch&&b.equals(n.pathParams,e.pathParams)))||!e&&!n||d.$broadcast("$routeChangeStart",n,e).defaultPrevented&&a&&a.preventDefault()}function s(){var a=t.current,e=n;if(x)a.params=e.params,b.copy(a.params,f),d.$broadcast("$routeUpdate",a);else if(e||a){B=!1;t.current=e;var c=g.resolve(e);p.$$incOutstandingRequestCount("$route");c.then(r).then(w).then(function(g){return g&&c.then(y).then(function(c){e===t.current&&(e&&(e.locals=c,b.copy(e.params,
|
||||
f)),d.$broadcast("$routeChangeSuccess",e,a))})}).catch(function(b){e===t.current&&d.$broadcast("$routeChangeError",e,a,b)}).finally(function(){p.$$completeOutstandingRequest(G,"$route")})}}function r(a){var e={route:a,hasRedirection:!1};if(a)if(a.redirectTo)if(b.isString(a.redirectTo))e.path=v(a.redirectTo,a.params),e.search=a.params,e.hasRedirection=!0;else{var d=c.path(),f=c.search();a=a.redirectTo(a.pathParams,d,f);b.isDefined(a)&&(e.url=a,e.hasRedirection=!0)}else if(a.resolveRedirectTo)return g.resolve(l.invoke(a.resolveRedirectTo)).then(function(a){b.isDefined(a)&&
|
||||
(e.url=a,e.hasRedirection=!0);return e});return e}function w(a){var b=!0;if(a.route!==t.current)b=!1;else if(a.hasRedirection){var g=c.url(),d=a.url;d?c.url(d).replace():d=c.path(a.path).search(a.search).replace().url();d!==g&&(b=!1)}return b}function y(a){if(a){var e=b.extend({},a.resolve);b.forEach(e,function(a,c){e[c]=b.isString(a)?l.get(a):l.invoke(a,null,null,c)});a=z(a);b.isDefined(a)&&(e.$template=a);return g.all(e)}}function z(a){var e,c;b.isDefined(e=a.template)?b.isFunction(e)&&(e=e(a.params)):
|
||||
b.isDefined(c=a.templateUrl)&&(b.isFunction(c)&&(c=c(a.params)),b.isDefined(c)&&(a.loadedTemplateUrl=q.valueOf(c),e=k(c)));return e}function A(){var a,e;b.forEach(h,function(d,g){var f;if(f=!e){var h=c.path();f=d.keys;var l={};if(d.regexp)if(h=d.regexp.exec(h)){for(var k=1,p=h.length;k<p;++k){var m=f[k-1],n=h[k];m&&n&&(l[m.name]=n)}f=l}else f=null;else f=null;f=a=f}f&&(e=u(d,{params:b.extend({},c.search(),a),pathParams:a}),e.$$route=d)});return e||h[null]&&u(h[null],{params:{},pathParams:{}})}function v(a,
|
||||
c){var d=[];b.forEach((a||"").split(":"),function(a,b){if(0===b)d.push(a);else{var f=a.match(/(\w+)(?:[?*])?(.*)/),g=f[1];d.push(c[g]);d.push(f[2]||"");delete c[g]}});return d.join("")}var B=!1,n,x,t={routes:h,reload:function(){B=!0;var a={defaultPrevented:!1,preventDefault:function(){this.defaultPrevented=!0;B=!1}};d.$evalAsync(function(){m(a);a.defaultPrevented||s()})},updateParams:function(a){if(this.current&&this.current.$$route)a=b.extend({},this.current.params,a),c.path(v(this.current.$$route.originalPath,
|
||||
a)),c.search(a);else throw H("norout");}};d.$on("$locationChangeStart",m);d.$on("$locationChangeSuccess",s);return t}]}).run(A),H=b.$$minErr("ngRoute"),p;A.$inject=["$injector"];y.provider("$routeParams",function(){this.$get=function(){return{}}});y.directive("ngView",v);y.directive("ngView",x);v.$inject=["$route","$anchorScroll","$animate"];x.$inject=["$compile","$controller","$route"]})(window,window.angular);
|
||||
//# sourceMappingURL=angular-route.min.js.map
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"name": "angular-route",
|
||||
"version": "1.5.11",
|
||||
"version": "1.7.8",
|
||||
"license": "MIT",
|
||||
"main": "./angular-route.js",
|
||||
"ignore": [],
|
||||
"dependencies": {
|
||||
"angular": "1.5.11"
|
||||
"angular": "1.7.8"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "angular-route",
|
||||
"version": "1.5.11",
|
||||
"version": "1.7.8",
|
||||
"description": "AngularJS router module",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue