MCPcopy Create free account
hub / github.com/apache/cloudstack / setupModuleLoader

Function setupModuleLoader

tools/ngui/static/js/lib/angular.js:1062–1300  ·  view source on GitHub ↗

* @ngdoc interface * @name angular.Module * @description * * Interface for configuring angular angular.module modules.

(window)

Source from the content-addressed store, hash-verified

1060 */
1061
1062function setupModuleLoader(window) {
1063
1064 function ensure(obj, name, factory) {
1065 return obj[name] || (obj[name] = factory());
1066 }
1067
1068 return ensure(ensure(window, 'angular', Object), 'module', function() {
1069 /** @type {Object.<string, angular.Module>} */
1070 var modules = {};
1071
1072 /**
1073 * @ngdoc function
1074 * @name angular.module
1075 * @description
1076 *
1077 * The `angular.module` is a global place for creating and registering Angular modules. All
1078 * modules (angular core or 3rd party) that should be available to an application must be
1079 * registered using this mechanism.
1080 *
1081 *
1082 * # Module
1083 *
1084 * A module is a collocation of services, directives, filters, and configuration information. Module
1085 * is used to configure the {@link AUTO.$injector $injector}.
1086 *
1087 * <pre>
1088 * // Create a new module
1089 * var myModule = angular.module('myModule', []);
1090 *
1091 * // register a new service
1092 * myModule.value('appName', 'MyCoolApp');
1093 *
1094 * // configure existing services inside initialization blocks.
1095 * myModule.config(function($locationProvider) {
1096 * // Configure existing providers
1097 * $locationProvider.hashPrefix('!');
1098 * });
1099 * </pre>
1100 *
1101 * Then you can create an injector and load your modules like this:
1102 *
1103 * <pre>
1104 * var injector = angular.injector(['ng', 'MyModule'])
1105 * </pre>
1106 *
1107 * However it's more likely that you'll just use
1108 * {@link ng.directive:ngApp ngApp} or
1109 * {@link angular.bootstrap} to simplify this process for you.
1110 *
1111 * @param {!string} name The name of the module to create or retrieve.
1112 * @param {Array.<string>=} requires If specified then new module is being created. If unspecified then the
1113 * the module is being retrieved for further configuration.
1114 * @param {Function} configFn Optional configuration function for the module. Same as
1115 * {@link angular.Module#config Module#config()}.
1116 * @returns {module} new module with the {@link angular.Module} api.
1117 */
1118 return function module(name, requires, configFn) {
1119 if (requires && modules.hasOwnProperty(name)) {

Callers 1

publishExternalAPIFunction · 0.85

Calls 3

ensureFunction · 0.85
invokeLaterFunction · 0.85
ErrorFunction · 0.50

Tested by

no test coverage detected