* @ngdoc type * @name angular.Module * @module ng * @description * * Interface for configuring AngularJS angular.module modules.
(window)
| 2184 | */ |
| 2185 | |
| 2186 | function setupModuleLoader(window) { |
| 2187 | |
| 2188 | var $injectorMinErr = minErr('$injector'); |
| 2189 | var ngMinErr = minErr('ng'); |
| 2190 | |
| 2191 | function ensure(obj, name, factory) { |
| 2192 | return obj[name] || (obj[name] = factory()); |
| 2193 | } |
| 2194 | |
| 2195 | var angular = ensure(window, 'angular', Object); |
| 2196 | |
| 2197 | // We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap |
| 2198 | angular.$$minErr = angular.$$minErr || minErr; |
| 2199 | |
| 2200 | return ensure(angular, 'module', function() { |
| 2201 | /** @type {Object.<string, angular.Module>} */ |
| 2202 | var modules = {}; |
| 2203 | |
| 2204 | /** |
| 2205 | * @ngdoc function |
| 2206 | * @name angular.module |
| 2207 | * @module ng |
| 2208 | * @description |
| 2209 | * |
| 2210 | * The `angular.module` is a global place for creating, registering and retrieving AngularJS |
| 2211 | * modules. |
| 2212 | * All modules (AngularJS core or 3rd party) that should be available to an application must be |
| 2213 | * registered using this mechanism. |
| 2214 | * |
| 2215 | * Passing one argument retrieves an existing {@link angular.Module}, |
| 2216 | * whereas passing more than one argument creates a new {@link angular.Module} |
| 2217 | * |
| 2218 | * |
| 2219 | * # Module |
| 2220 | * |
| 2221 | * A module is a collection of services, directives, controllers, filters, and configuration information. |
| 2222 | * `angular.module` is used to configure the {@link auto.$injector $injector}. |
| 2223 | * |
| 2224 | * ```js |
| 2225 | * // Create a new module |
| 2226 | * var myModule = angular.module('myModule', []); |
| 2227 | * |
| 2228 | * // register a new service |
| 2229 | * myModule.value('appName', 'MyCoolApp'); |
| 2230 | * |
| 2231 | * // configure existing services inside initialization blocks. |
| 2232 | * myModule.config(['$locationProvider', function($locationProvider) { |
| 2233 | * // Configure existing providers |
| 2234 | * $locationProvider.hashPrefix('!'); |
| 2235 | * }]); |
| 2236 | * ``` |
| 2237 | * |
| 2238 | * Then you can create an injector and load your modules like this: |
| 2239 | * |
| 2240 | * ```js |
| 2241 | * var injector = angular.injector(['ng', 'myModule']) |
| 2242 | * ``` |
| 2243 | * |
no test coverage detected