2014-01-05 16:07:11 +00:00
|
|
|
/**
|
2019-05-09 19:56:23 +00:00
|
|
|
* @license AngularJS v1.7.8
|
|
|
|
* (c) 2010-2018 Google, Inc. http://angularjs.org
|
2014-01-05 16:07:11 +00:00
|
|
|
* License: MIT
|
|
|
|
*/
|
|
|
|
|
|
|
|
(function() {'use strict';
|
2019-05-09 19:56:23 +00:00
|
|
|
// NOTE:
|
|
|
|
// These functions are copied here from `src/Angular.js`, because they are needed inside the
|
|
|
|
// `angular-loader.js` closure and need to be available before the main `angular.js` script has
|
|
|
|
// been loaded.
|
|
|
|
function isFunction(value) {return typeof value === 'function';}
|
|
|
|
function isDefined(value) {return typeof value !== 'undefined';}
|
|
|
|
function isNumber(value) {return typeof value === 'number';}
|
|
|
|
function isObject(value) {return value !== null && typeof value === 'object';}
|
|
|
|
function isScope(obj) {return obj && obj.$evalAsync && obj.$watch;}
|
|
|
|
function isUndefined(value) {return typeof value === 'undefined';}
|
|
|
|
function isWindow(obj) {return obj && obj.window === obj;}
|
|
|
|
function sliceArgs(args, startIndex) {return Array.prototype.slice.call(args, startIndex || 0);}
|
|
|
|
function toJsonReplacer(key, value) {
|
|
|
|
var val = value;
|
|
|
|
|
|
|
|
if (typeof key === 'string' && key.charAt(0) === '$' && key.charAt(1) === '$') {
|
|
|
|
val = undefined;
|
|
|
|
} else if (isWindow(value)) {
|
|
|
|
val = '$WINDOW';
|
|
|
|
} else if (value && window.document === value) {
|
|
|
|
val = '$DOCUMENT';
|
|
|
|
} else if (isScope(value)) {
|
|
|
|
val = '$SCOPE';
|
|
|
|
}
|
|
|
|
|
|
|
|
return val;
|
|
|
|
}
|
2014-01-05 16:07:11 +00:00
|
|
|
|
2019-05-09 19:56:23 +00:00
|
|
|
/* exported toDebugString */
|
2016-06-16 16:39:05 +00:00
|
|
|
|
2019-05-09 19:56:23 +00:00
|
|
|
function serializeObject(obj, maxDepth) {
|
2016-06-16 16:39:05 +00:00
|
|
|
var seen = [];
|
|
|
|
|
2019-05-09 19:56:23 +00:00
|
|
|
// There is no direct way to stringify object until reaching a specific depth
|
|
|
|
// and a very deep object can cause a performance issue, so we copy the object
|
|
|
|
// based on this specific depth and then stringify it.
|
|
|
|
if (isValidObjectMaxDepth(maxDepth)) {
|
|
|
|
// This file is also included in `angular-loader`, so `copy()` might not always be available in
|
|
|
|
// the closure. Therefore, it is lazily retrieved as `angular.copy()` when needed.
|
|
|
|
obj = angular.copy(obj, null, maxDepth);
|
|
|
|
}
|
2016-06-16 16:39:05 +00:00
|
|
|
return JSON.stringify(obj, function(key, val) {
|
|
|
|
val = toJsonReplacer(key, val);
|
|
|
|
if (isObject(val)) {
|
|
|
|
|
|
|
|
if (seen.indexOf(val) >= 0) return '...';
|
|
|
|
|
|
|
|
seen.push(val);
|
|
|
|
}
|
|
|
|
return val;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-05-09 19:56:23 +00:00
|
|
|
function toDebugString(obj, maxDepth) {
|
2016-06-16 16:39:05 +00:00
|
|
|
if (typeof obj === 'function') {
|
|
|
|
return obj.toString().replace(/ \{[\s\S]*$/, '');
|
|
|
|
} else if (isUndefined(obj)) {
|
|
|
|
return 'undefined';
|
|
|
|
} else if (typeof obj !== 'string') {
|
2019-05-09 19:56:23 +00:00
|
|
|
return serializeObject(obj, maxDepth);
|
2016-06-16 16:39:05 +00:00
|
|
|
}
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
2019-05-09 19:56:23 +00:00
|
|
|
/* exported
|
|
|
|
minErrConfig,
|
|
|
|
errorHandlingConfig,
|
|
|
|
isValidObjectMaxDepth
|
|
|
|
*/
|
|
|
|
|
|
|
|
var minErrConfig = {
|
|
|
|
objectMaxDepth: 5,
|
|
|
|
urlErrorParamsEnabled: true
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ngdoc function
|
|
|
|
* @name angular.errorHandlingConfig
|
|
|
|
* @module ng
|
|
|
|
* @kind function
|
|
|
|
*
|
|
|
|
* @description
|
|
|
|
* Configure several aspects of error handling in AngularJS if used as a setter or return the
|
|
|
|
* current configuration if used as a getter. The following options are supported:
|
|
|
|
*
|
|
|
|
* - **objectMaxDepth**: The maximum depth to which objects are traversed when stringified for error messages.
|
|
|
|
*
|
|
|
|
* Omitted or undefined options will leave the corresponding configuration values unchanged.
|
|
|
|
*
|
|
|
|
* @param {Object=} config - The configuration object. May only contain the options that need to be
|
|
|
|
* updated. Supported keys:
|
|
|
|
*
|
|
|
|
* * `objectMaxDepth` **{Number}** - The max depth for stringifying objects. Setting to a
|
|
|
|
* non-positive or non-numeric value, removes the max depth limit.
|
|
|
|
* Default: 5
|
|
|
|
*
|
|
|
|
* * `urlErrorParamsEnabled` **{Boolean}** - Specifies wether the generated error url will
|
|
|
|
* contain the parameters of the thrown error. Disabling the parameters can be useful if the
|
|
|
|
* generated error url is very long.
|
|
|
|
*
|
|
|
|
* Default: true. When used without argument, it returns the current value.
|
|
|
|
*/
|
|
|
|
function errorHandlingConfig(config) {
|
|
|
|
if (isObject(config)) {
|
|
|
|
if (isDefined(config.objectMaxDepth)) {
|
|
|
|
minErrConfig.objectMaxDepth = isValidObjectMaxDepth(config.objectMaxDepth) ? config.objectMaxDepth : NaN;
|
|
|
|
}
|
|
|
|
if (isDefined(config.urlErrorParamsEnabled) && isBoolean(config.urlErrorParamsEnabled)) {
|
|
|
|
minErrConfig.urlErrorParamsEnabled = config.urlErrorParamsEnabled;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return minErrConfig;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @private
|
|
|
|
* @param {Number} maxDepth
|
|
|
|
* @return {boolean}
|
|
|
|
*/
|
|
|
|
function isValidObjectMaxDepth(maxDepth) {
|
|
|
|
return isNumber(maxDepth) && maxDepth > 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-01-05 16:07:11 +00:00
|
|
|
/**
|
|
|
|
* @description
|
|
|
|
*
|
|
|
|
* This object provides a utility for producing rich Error messages within
|
2019-05-09 19:56:23 +00:00
|
|
|
* AngularJS. It can be called as follows:
|
2014-01-05 16:07:11 +00:00
|
|
|
*
|
|
|
|
* var exampleMinErr = minErr('example');
|
|
|
|
* throw exampleMinErr('one', 'This {0} is {1}', foo, bar);
|
|
|
|
*
|
|
|
|
* The above creates an instance of minErr in the example namespace. The
|
|
|
|
* resulting error will have a namespaced error code of example.one. The
|
|
|
|
* resulting error will replace {0} with the value of foo, and {1} with the
|
|
|
|
* value of bar. The object is not restricted in the number of arguments it can
|
|
|
|
* take.
|
|
|
|
*
|
|
|
|
* If fewer arguments are specified than necessary for interpolation, the extra
|
|
|
|
* interpolation markers will be preserved in the final string.
|
|
|
|
*
|
|
|
|
* Since data will be parsed statically during a build step, some restrictions
|
|
|
|
* are applied with respect to how minErr instances are created and called.
|
|
|
|
* Instances should have names of the form namespaceMinErr for a minErr created
|
|
|
|
* using minErr('namespace') . Error codes, namespaces and template strings
|
|
|
|
* should all be static strings, not variables or general expressions.
|
|
|
|
*
|
|
|
|
* @param {string} module The namespace to use for the new minErr instance.
|
2014-09-10 18:22:47 +00:00
|
|
|
* @param {function} ErrorConstructor Custom error constructor to be instantiated when returning
|
|
|
|
* error from returned function, for cases when a particular type of error is useful.
|
2014-07-01 18:46:16 +00:00
|
|
|
* @returns {function(code:string, template:string, ...templateArgs): Error} minErr instance
|
2014-01-05 16:07:11 +00:00
|
|
|
*/
|
|
|
|
|
2014-09-10 18:22:47 +00:00
|
|
|
function minErr(module, ErrorConstructor) {
|
|
|
|
ErrorConstructor = ErrorConstructor || Error;
|
2015-10-01 17:06:16 +00:00
|
|
|
|
2019-05-09 19:56:23 +00:00
|
|
|
var url = 'https://errors.angularjs.org/1.7.8/';
|
|
|
|
var regex = url.replace('.', '\\.') + '[\\s\\S]*';
|
|
|
|
var errRegExp = new RegExp(regex, 'g');
|
|
|
|
|
|
|
|
return function() {
|
|
|
|
var code = arguments[0],
|
|
|
|
template = arguments[1],
|
2015-10-01 17:06:16 +00:00
|
|
|
message = '[' + (module ? module + ':' : '') + code + '] ',
|
2019-05-09 19:56:23 +00:00
|
|
|
templateArgs = sliceArgs(arguments, 2).map(function(arg) {
|
|
|
|
return toDebugString(arg, minErrConfig.objectMaxDepth);
|
|
|
|
}),
|
2015-10-01 17:06:16 +00:00
|
|
|
paramPrefix, i;
|
|
|
|
|
2019-05-09 19:56:23 +00:00
|
|
|
// A minErr message has two parts: the message itself and the url that contains the
|
|
|
|
// encoded message.
|
|
|
|
// The message's parameters can contain other error messages which also include error urls.
|
|
|
|
// To prevent the messages from getting too long, we strip the error urls from the parameters.
|
|
|
|
|
2015-10-01 17:06:16 +00:00
|
|
|
message += template.replace(/\{\d+\}/g, function(match) {
|
2019-05-09 19:56:23 +00:00
|
|
|
var index = +match.slice(1, -1);
|
2015-10-01 17:06:16 +00:00
|
|
|
|
2019-05-09 19:56:23 +00:00
|
|
|
if (index < templateArgs.length) {
|
|
|
|
return templateArgs[index].replace(errRegExp, '');
|
2014-01-05 16:07:11 +00:00
|
|
|
}
|
2015-10-01 17:06:16 +00:00
|
|
|
|
2014-01-05 16:07:11 +00:00
|
|
|
return match;
|
|
|
|
});
|
|
|
|
|
2019-05-09 19:56:23 +00:00
|
|
|
message += '\n' + url + (module ? module + '/' : '') + code;
|
2015-10-01 17:06:16 +00:00
|
|
|
|
2019-05-09 19:56:23 +00:00
|
|
|
if (minErrConfig.urlErrorParamsEnabled) {
|
|
|
|
for (i = 0, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') {
|
|
|
|
message += paramPrefix + 'p' + i + '=' + encodeURIComponent(templateArgs[i]);
|
|
|
|
}
|
2014-01-05 16:07:11 +00:00
|
|
|
}
|
2015-10-01 17:06:16 +00:00
|
|
|
|
2014-09-10 18:22:47 +00:00
|
|
|
return new ErrorConstructor(message);
|
2014-01-05 16:07:11 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-07-01 18:46:16 +00:00
|
|
|
* @ngdoc type
|
2014-01-05 16:07:11 +00:00
|
|
|
* @name angular.Module
|
2014-07-01 18:46:16 +00:00
|
|
|
* @module ng
|
2014-01-05 16:07:11 +00:00
|
|
|
* @description
|
|
|
|
*
|
2019-05-09 19:56:23 +00:00
|
|
|
* Interface for configuring AngularJS {@link angular.module modules}.
|
2014-01-05 16:07:11 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
function setupModuleLoader(window) {
|
|
|
|
|
|
|
|
var $injectorMinErr = minErr('$injector');
|
|
|
|
var ngMinErr = minErr('ng');
|
|
|
|
|
|
|
|
function ensure(obj, name, factory) {
|
|
|
|
return obj[name] || (obj[name] = factory());
|
|
|
|
}
|
|
|
|
|
|
|
|
var angular = ensure(window, 'angular', Object);
|
|
|
|
|
|
|
|
// We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap
|
|
|
|
angular.$$minErr = angular.$$minErr || minErr;
|
|
|
|
|
|
|
|
return ensure(angular, 'module', function() {
|
|
|
|
/** @type {Object.<string, angular.Module>} */
|
|
|
|
var modules = {};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ngdoc function
|
|
|
|
* @name angular.module
|
2014-07-01 18:46:16 +00:00
|
|
|
* @module ng
|
2014-01-05 16:07:11 +00:00
|
|
|
* @description
|
|
|
|
*
|
2019-05-09 19:56:23 +00:00
|
|
|
* The `angular.module` is a global place for creating, registering and retrieving AngularJS
|
2014-01-05 16:07:11 +00:00
|
|
|
* modules.
|
2019-05-09 19:56:23 +00:00
|
|
|
* All modules (AngularJS core or 3rd party) that should be available to an application must be
|
2014-01-05 16:07:11 +00:00
|
|
|
* registered using this mechanism.
|
|
|
|
*
|
2015-10-01 17:06:16 +00:00
|
|
|
* Passing one argument retrieves an existing {@link angular.Module},
|
|
|
|
* whereas passing more than one argument creates a new {@link angular.Module}
|
2014-01-05 16:07:11 +00:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* # Module
|
|
|
|
*
|
2014-07-23 16:34:13 +00:00
|
|
|
* A module is a collection of services, directives, controllers, filters, and configuration information.
|
2014-07-01 18:46:16 +00:00
|
|
|
* `angular.module` is used to configure the {@link auto.$injector $injector}.
|
2014-01-05 16:07:11 +00:00
|
|
|
*
|
2014-07-01 18:46:16 +00:00
|
|
|
* ```js
|
2014-01-05 16:07:11 +00:00
|
|
|
* // Create a new module
|
|
|
|
* var myModule = angular.module('myModule', []);
|
|
|
|
*
|
|
|
|
* // register a new service
|
|
|
|
* myModule.value('appName', 'MyCoolApp');
|
|
|
|
*
|
|
|
|
* // configure existing services inside initialization blocks.
|
2014-07-01 18:46:16 +00:00
|
|
|
* myModule.config(['$locationProvider', function($locationProvider) {
|
2014-01-05 16:07:11 +00:00
|
|
|
* // Configure existing providers
|
|
|
|
* $locationProvider.hashPrefix('!');
|
2014-07-01 18:46:16 +00:00
|
|
|
* }]);
|
|
|
|
* ```
|
2014-01-05 16:07:11 +00:00
|
|
|
*
|
|
|
|
* Then you can create an injector and load your modules like this:
|
|
|
|
*
|
2014-07-01 18:46:16 +00:00
|
|
|
* ```js
|
|
|
|
* var injector = angular.injector(['ng', 'myModule'])
|
|
|
|
* ```
|
2014-01-05 16:07:11 +00:00
|
|
|
*
|
|
|
|
* However it's more likely that you'll just use
|
|
|
|
* {@link ng.directive:ngApp ngApp} or
|
|
|
|
* {@link angular.bootstrap} to simplify this process for you.
|
|
|
|
*
|
|
|
|
* @param {!string} name The name of the module to create or retrieve.
|
2014-07-01 18:46:16 +00:00
|
|
|
* @param {!Array.<string>=} requires If specified then new module is being created. If
|
|
|
|
* unspecified then the module is being retrieved for further configuration.
|
|
|
|
* @param {Function=} configFn Optional configuration function for the module. Same as
|
|
|
|
* {@link angular.Module#config Module#config()}.
|
2016-06-16 16:39:05 +00:00
|
|
|
* @returns {angular.Module} new module with the {@link angular.Module} api.
|
2014-01-05 16:07:11 +00:00
|
|
|
*/
|
|
|
|
return function module(name, requires, configFn) {
|
2019-05-09 19:56:23 +00:00
|
|
|
|
|
|
|
var info = {};
|
|
|
|
|
2014-01-05 16:07:11 +00:00
|
|
|
var assertNotHasOwnProperty = function(name, context) {
|
|
|
|
if (name === 'hasOwnProperty') {
|
|
|
|
throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
assertNotHasOwnProperty(name, 'module');
|
|
|
|
if (requires && modules.hasOwnProperty(name)) {
|
|
|
|
modules[name] = null;
|
|
|
|
}
|
|
|
|
return ensure(modules, name, function() {
|
|
|
|
if (!requires) {
|
2019-05-09 19:56:23 +00:00
|
|
|
throw $injectorMinErr('nomod', 'Module \'{0}\' is not available! You either misspelled ' +
|
|
|
|
'the module name or forgot to load it. If registering a module ensure that you ' +
|
|
|
|
'specify the dependencies as the second argument.', name);
|
2014-01-05 16:07:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/** @type {!Array.<Array.<*>>} */
|
|
|
|
var invokeQueue = [];
|
|
|
|
|
2014-07-01 18:46:16 +00:00
|
|
|
/** @type {!Array.<Function>} */
|
|
|
|
var configBlocks = [];
|
|
|
|
|
2014-01-05 16:07:11 +00:00
|
|
|
/** @type {!Array.<Function>} */
|
|
|
|
var runBlocks = [];
|
|
|
|
|
2014-07-01 18:46:16 +00:00
|
|
|
var config = invokeLater('$injector', 'invoke', 'push', configBlocks);
|
2014-01-05 16:07:11 +00:00
|
|
|
|
|
|
|
/** @type {angular.Module} */
|
|
|
|
var moduleInstance = {
|
|
|
|
// Private state
|
|
|
|
_invokeQueue: invokeQueue,
|
2014-07-01 18:46:16 +00:00
|
|
|
_configBlocks: configBlocks,
|
2014-01-05 16:07:11 +00:00
|
|
|
_runBlocks: runBlocks,
|
|
|
|
|
2019-05-09 19:56:23 +00:00
|
|
|
/**
|
|
|
|
* @ngdoc method
|
|
|
|
* @name angular.Module#info
|
|
|
|
* @module ng
|
|
|
|
*
|
|
|
|
* @param {Object=} info Information about the module
|
|
|
|
* @returns {Object|Module} The current info object for this module if called as a getter,
|
|
|
|
* or `this` if called as a setter.
|
|
|
|
*
|
|
|
|
* @description
|
|
|
|
* Read and write custom information about this module.
|
|
|
|
* For example you could put the version of the module in here.
|
|
|
|
*
|
|
|
|
* ```js
|
|
|
|
* angular.module('myModule', []).info({ version: '1.0.0' });
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
* The version could then be read back out by accessing the module elsewhere:
|
|
|
|
*
|
|
|
|
* ```
|
|
|
|
* var version = angular.module('myModule').info().version;
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
* You can also retrieve this information during runtime via the
|
|
|
|
* {@link $injector#modules `$injector.modules`} property:
|
|
|
|
*
|
|
|
|
* ```js
|
|
|
|
* var version = $injector.modules['myModule'].info().version;
|
|
|
|
* ```
|
|
|
|
*/
|
|
|
|
info: function(value) {
|
|
|
|
if (isDefined(value)) {
|
|
|
|
if (!isObject(value)) throw ngMinErr('aobj', 'Argument \'{0}\' must be an object', 'value');
|
|
|
|
info = value;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
return info;
|
|
|
|
},
|
|
|
|
|
2014-01-05 16:07:11 +00:00
|
|
|
/**
|
|
|
|
* @ngdoc property
|
|
|
|
* @name angular.Module#requires
|
2014-07-01 18:46:16 +00:00
|
|
|
* @module ng
|
2014-09-10 18:22:47 +00:00
|
|
|
*
|
2014-01-05 16:07:11 +00:00
|
|
|
* @description
|
|
|
|
* Holds the list of modules which the injector will load before the current module is
|
|
|
|
* loaded.
|
|
|
|
*/
|
|
|
|
requires: requires,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ngdoc property
|
|
|
|
* @name angular.Module#name
|
2014-07-01 18:46:16 +00:00
|
|
|
* @module ng
|
2014-09-10 18:22:47 +00:00
|
|
|
*
|
2014-01-05 16:07:11 +00:00
|
|
|
* @description
|
2014-09-10 18:22:47 +00:00
|
|
|
* Name of the module.
|
2014-01-05 16:07:11 +00:00
|
|
|
*/
|
|
|
|
name: name,
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ngdoc method
|
|
|
|
* @name angular.Module#provider
|
2014-07-01 18:46:16 +00:00
|
|
|
* @module ng
|
2014-01-05 16:07:11 +00:00
|
|
|
* @param {string} name service name
|
|
|
|
* @param {Function} providerType Construction function for creating new instance of the
|
|
|
|
* service.
|
|
|
|
* @description
|
2014-07-01 18:46:16 +00:00
|
|
|
* See {@link auto.$provide#provider $provide.provider()}.
|
2014-01-05 16:07:11 +00:00
|
|
|
*/
|
2015-10-01 17:06:16 +00:00
|
|
|
provider: invokeLaterAndSetModuleName('$provide', 'provider'),
|
2014-01-05 16:07:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @ngdoc method
|
|
|
|
* @name angular.Module#factory
|
2014-07-01 18:46:16 +00:00
|
|
|
* @module ng
|
2014-01-05 16:07:11 +00:00
|
|
|
* @param {string} name service name
|
|
|
|
* @param {Function} providerFunction Function for creating new instance of the service.
|
|
|
|
* @description
|
2014-07-01 18:46:16 +00:00
|
|
|
* See {@link auto.$provide#factory $provide.factory()}.
|
2014-01-05 16:07:11 +00:00
|
|
|
*/
|
2015-10-01 17:06:16 +00:00
|
|
|
factory: invokeLaterAndSetModuleName('$provide', 'factory'),
|
2014-01-05 16:07:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @ngdoc method
|
|
|
|
* @name angular.Module#service
|
2014-07-01 18:46:16 +00:00
|
|
|
* @module ng
|
2014-01-05 16:07:11 +00:00
|
|
|
* @param {string} name service name
|
|
|
|
* @param {Function} constructor A constructor function that will be instantiated.
|
|
|
|
* @description
|
2014-07-01 18:46:16 +00:00
|
|
|
* See {@link auto.$provide#service $provide.service()}.
|
2014-01-05 16:07:11 +00:00
|
|
|
*/
|
2015-10-01 17:06:16 +00:00
|
|
|
service: invokeLaterAndSetModuleName('$provide', 'service'),
|
2014-01-05 16:07:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @ngdoc method
|
|
|
|
* @name angular.Module#value
|
2014-07-01 18:46:16 +00:00
|
|
|
* @module ng
|
2014-01-05 16:07:11 +00:00
|
|
|
* @param {string} name service name
|
|
|
|
* @param {*} object Service instance object.
|
|
|
|
* @description
|
2014-07-01 18:46:16 +00:00
|
|
|
* See {@link auto.$provide#value $provide.value()}.
|
2014-01-05 16:07:11 +00:00
|
|
|
*/
|
|
|
|
value: invokeLater('$provide', 'value'),
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ngdoc method
|
|
|
|
* @name angular.Module#constant
|
2014-07-01 18:46:16 +00:00
|
|
|
* @module ng
|
2014-01-05 16:07:11 +00:00
|
|
|
* @param {string} name constant name
|
|
|
|
* @param {*} object Constant value.
|
|
|
|
* @description
|
2016-06-16 16:39:05 +00:00
|
|
|
* Because the constants are fixed, they get applied before other provide methods.
|
2014-07-01 18:46:16 +00:00
|
|
|
* See {@link auto.$provide#constant $provide.constant()}.
|
2014-01-05 16:07:11 +00:00
|
|
|
*/
|
|
|
|
constant: invokeLater('$provide', 'constant', 'unshift'),
|
|
|
|
|
2015-10-01 17:06:16 +00:00
|
|
|
/**
|
|
|
|
* @ngdoc method
|
|
|
|
* @name angular.Module#decorator
|
|
|
|
* @module ng
|
2016-06-16 16:39:05 +00:00
|
|
|
* @param {string} name The name of the service to decorate.
|
|
|
|
* @param {Function} decorFn This function will be invoked when the service needs to be
|
|
|
|
* instantiated and should return the decorated service instance.
|
2015-10-01 17:06:16 +00:00
|
|
|
* @description
|
|
|
|
* See {@link auto.$provide#decorator $provide.decorator()}.
|
|
|
|
*/
|
2019-05-09 19:56:23 +00:00
|
|
|
decorator: invokeLaterAndSetModuleName('$provide', 'decorator', configBlocks),
|
2015-10-01 17:06:16 +00:00
|
|
|
|
2014-01-05 16:07:11 +00:00
|
|
|
/**
|
|
|
|
* @ngdoc method
|
|
|
|
* @name angular.Module#animation
|
2014-07-01 18:46:16 +00:00
|
|
|
* @module ng
|
2014-01-05 16:07:11 +00:00
|
|
|
* @param {string} name animation name
|
|
|
|
* @param {Function} animationFactory Factory function for creating new instance of an
|
|
|
|
* animation.
|
|
|
|
* @description
|
|
|
|
*
|
|
|
|
* **NOTE**: animations take effect only if the **ngAnimate** module is loaded.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Defines an animation hook that can be later used with
|
2015-10-01 17:06:16 +00:00
|
|
|
* {@link $animate $animate} service and directives that use this service.
|
2014-01-05 16:07:11 +00:00
|
|
|
*
|
2014-07-01 18:46:16 +00:00
|
|
|
* ```js
|
2014-01-05 16:07:11 +00:00
|
|
|
* module.animation('.animation-name', function($inject1, $inject2) {
|
|
|
|
* return {
|
|
|
|
* eventName : function(element, done) {
|
|
|
|
* //code to run the animation
|
|
|
|
* //once complete, then run done()
|
|
|
|
* return function cancellationFunction(element) {
|
|
|
|
* //code to cancel the animation
|
|
|
|
* }
|
|
|
|
* }
|
|
|
|
* }
|
|
|
|
* })
|
2014-07-01 18:46:16 +00:00
|
|
|
* ```
|
2014-01-05 16:07:11 +00:00
|
|
|
*
|
2014-11-11 10:55:03 +00:00
|
|
|
* See {@link ng.$animateProvider#register $animateProvider.register()} and
|
2014-01-05 16:07:11 +00:00
|
|
|
* {@link ngAnimate ngAnimate module} for more information.
|
|
|
|
*/
|
2015-10-01 17:06:16 +00:00
|
|
|
animation: invokeLaterAndSetModuleName('$animateProvider', 'register'),
|
2014-01-05 16:07:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @ngdoc method
|
|
|
|
* @name angular.Module#filter
|
2014-07-01 18:46:16 +00:00
|
|
|
* @module ng
|
2019-05-09 19:56:23 +00:00
|
|
|
* @param {string} name Filter name - this must be a valid AngularJS expression identifier
|
2014-01-05 16:07:11 +00:00
|
|
|
* @param {Function} filterFactory Factory function for creating new instance of filter.
|
|
|
|
* @description
|
|
|
|
* See {@link ng.$filterProvider#register $filterProvider.register()}.
|
2015-10-01 17:06:16 +00:00
|
|
|
*
|
|
|
|
* <div class="alert alert-warning">
|
2019-05-09 19:56:23 +00:00
|
|
|
* **Note:** Filter names must be valid AngularJS {@link expression} identifiers, such as `uppercase` or `orderBy`.
|
2015-10-01 17:06:16 +00:00
|
|
|
* Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace
|
|
|
|
* your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores
|
|
|
|
* (`myapp_subsection_filterx`).
|
|
|
|
* </div>
|
2014-01-05 16:07:11 +00:00
|
|
|
*/
|
2015-10-01 17:06:16 +00:00
|
|
|
filter: invokeLaterAndSetModuleName('$filterProvider', 'register'),
|
2014-01-05 16:07:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @ngdoc method
|
|
|
|
* @name angular.Module#controller
|
2014-07-01 18:46:16 +00:00
|
|
|
* @module ng
|
2014-01-05 16:07:11 +00:00
|
|
|
* @param {string|Object} name Controller name, or an object map of controllers where the
|
|
|
|
* keys are the names and the values are the constructors.
|
|
|
|
* @param {Function} constructor Controller constructor function.
|
|
|
|
* @description
|
|
|
|
* See {@link ng.$controllerProvider#register $controllerProvider.register()}.
|
|
|
|
*/
|
2015-10-01 17:06:16 +00:00
|
|
|
controller: invokeLaterAndSetModuleName('$controllerProvider', 'register'),
|
2014-01-05 16:07:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @ngdoc method
|
|
|
|
* @name angular.Module#directive
|
2014-07-01 18:46:16 +00:00
|
|
|
* @module ng
|
2014-01-05 16:07:11 +00:00
|
|
|
* @param {string|Object} name Directive name, or an object map of directives where the
|
|
|
|
* keys are the names and the values are the factories.
|
|
|
|
* @param {Function} directiveFactory Factory function for creating new instance of
|
|
|
|
* directives.
|
|
|
|
* @description
|
2014-07-01 18:46:16 +00:00
|
|
|
* See {@link ng.$compileProvider#directive $compileProvider.directive()}.
|
2014-01-05 16:07:11 +00:00
|
|
|
*/
|
2015-10-01 17:06:16 +00:00
|
|
|
directive: invokeLaterAndSetModuleName('$compileProvider', 'directive'),
|
2014-01-05 16:07:11 +00:00
|
|
|
|
2016-06-16 16:39:05 +00:00
|
|
|
/**
|
|
|
|
* @ngdoc method
|
|
|
|
* @name angular.Module#component
|
|
|
|
* @module ng
|
2019-05-09 19:56:23 +00:00
|
|
|
* @param {string|Object} name Name of the component in camelCase (i.e. `myComp` which will match `<my-comp>`),
|
|
|
|
* or an object map of components where the keys are the names and the values are the component definition objects.
|
2016-06-16 16:39:05 +00:00
|
|
|
* @param {Object} options Component definition object (a simplified
|
|
|
|
* {@link ng.$compile#directive-definition-object directive definition object})
|
|
|
|
*
|
|
|
|
* @description
|
|
|
|
* See {@link ng.$compileProvider#component $compileProvider.component()}.
|
|
|
|
*/
|
|
|
|
component: invokeLaterAndSetModuleName('$compileProvider', 'component'),
|
|
|
|
|
2014-01-05 16:07:11 +00:00
|
|
|
/**
|
|
|
|
* @ngdoc method
|
|
|
|
* @name angular.Module#config
|
2014-07-01 18:46:16 +00:00
|
|
|
* @module ng
|
2014-01-05 16:07:11 +00:00
|
|
|
* @param {Function} configFn Execute this function on module load. Useful for service
|
|
|
|
* configuration.
|
|
|
|
* @description
|
2019-05-09 19:56:23 +00:00
|
|
|
* Use this method to configure services by injecting their
|
|
|
|
* {@link angular.Module#provider `providers`}, e.g. for adding routes to the
|
|
|
|
* {@link ngRoute.$routeProvider $routeProvider}.
|
|
|
|
*
|
|
|
|
* Note that you can only inject {@link angular.Module#provider `providers`} and
|
|
|
|
* {@link angular.Module#constant `constants`} into this function.
|
|
|
|
*
|
2014-07-01 18:46:16 +00:00
|
|
|
* For more about how to configure services, see
|
2014-11-11 10:55:03 +00:00
|
|
|
* {@link providers#provider-recipe Provider Recipe}.
|
2014-01-05 16:07:11 +00:00
|
|
|
*/
|
|
|
|
config: config,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ngdoc method
|
|
|
|
* @name angular.Module#run
|
2014-07-01 18:46:16 +00:00
|
|
|
* @module ng
|
2014-01-05 16:07:11 +00:00
|
|
|
* @param {Function} initializationFn Execute this function after injector creation.
|
|
|
|
* Useful for application initialization.
|
|
|
|
* @description
|
|
|
|
* Use this method to register work which should be performed when the injector is done
|
|
|
|
* loading all modules.
|
|
|
|
*/
|
|
|
|
run: function(block) {
|
|
|
|
runBlocks.push(block);
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
if (configFn) {
|
|
|
|
config(configFn);
|
|
|
|
}
|
|
|
|
|
2014-11-11 10:55:03 +00:00
|
|
|
return moduleInstance;
|
2014-01-05 16:07:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {string} provider
|
|
|
|
* @param {string} method
|
|
|
|
* @param {String=} insertMethod
|
|
|
|
* @returns {angular.Module}
|
|
|
|
*/
|
2014-07-01 18:46:16 +00:00
|
|
|
function invokeLater(provider, method, insertMethod, queue) {
|
|
|
|
if (!queue) queue = invokeQueue;
|
2014-01-05 16:07:11 +00:00
|
|
|
return function() {
|
2014-07-01 18:46:16 +00:00
|
|
|
queue[insertMethod || 'push']([provider, method, arguments]);
|
2014-01-05 16:07:11 +00:00
|
|
|
return moduleInstance;
|
|
|
|
};
|
|
|
|
}
|
2015-10-01 17:06:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {string} provider
|
|
|
|
* @param {string} method
|
|
|
|
* @returns {angular.Module}
|
|
|
|
*/
|
2019-05-09 19:56:23 +00:00
|
|
|
function invokeLaterAndSetModuleName(provider, method, queue) {
|
|
|
|
if (!queue) queue = invokeQueue;
|
2015-10-01 17:06:16 +00:00
|
|
|
return function(recipeName, factoryFunction) {
|
|
|
|
if (factoryFunction && isFunction(factoryFunction)) factoryFunction.$$moduleName = name;
|
2019-05-09 19:56:23 +00:00
|
|
|
queue.push([provider, method, arguments]);
|
2015-10-01 17:06:16 +00:00
|
|
|
return moduleInstance;
|
|
|
|
};
|
|
|
|
}
|
2014-01-05 16:07:11 +00:00
|
|
|
});
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
setupModuleLoader(window);
|
|
|
|
})(window);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Closure compiler type information
|
|
|
|
*
|
|
|
|
* @typedef { {
|
|
|
|
* requires: !Array.<string>,
|
|
|
|
* invokeQueue: !Array.<Array.<*>>,
|
|
|
|
*
|
|
|
|
* service: function(string, Function):angular.Module,
|
|
|
|
* factory: function(string, Function):angular.Module,
|
|
|
|
* value: function(string, *):angular.Module,
|
|
|
|
*
|
|
|
|
* filter: function(string, Function):angular.Module,
|
|
|
|
*
|
|
|
|
* init: function(Function):angular.Module
|
|
|
|
* } }
|
|
|
|
*/
|
|
|
|
angular.Module;
|
|
|
|
|