* @ngdoc type * @name angular.Module * @module ng * @description * * Interface for configuring angular angular.module modules.
(window)
| 2049 | */ |
| 2050 | |
| 2051 | function setupModuleLoader(window) { |
| 2052 | |
| 2053 | var $injectorMinErr = minErr('$injector'); |
| 2054 | var ngMinErr = minErr('ng'); |
| 2055 | |
| 2056 | function ensure(obj, name, factory) { |
| 2057 | return obj[name] || (obj[name] = factory()); |
| 2058 | } |
| 2059 | |
| 2060 | var angular = ensure(window, 'angular', Object); |
| 2061 | |
| 2062 | // We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap |
| 2063 | angular.$$minErr = angular.$$minErr || minErr; |
| 2064 | |
| 2065 | return ensure(angular, 'module', function() { |
| 2066 | /** @type {Object.<string, angular.Module>} */ |
| 2067 | var modules = {}; |
| 2068 | |
| 2069 | /** |
| 2070 | * @ngdoc function |
| 2071 | * @name angular.module |
| 2072 | * @module ng |
| 2073 | * @description |
| 2074 | * |
| 2075 | * The `angular.module` is a global place for creating, registering and retrieving Angular |
| 2076 | * modules. |
| 2077 | * All modules (angular core or 3rd party) that should be available to an application must be |
| 2078 | * registered using this mechanism. |
| 2079 | * |
| 2080 | * Passing one argument retrieves an existing {@link angular.Module}, |
| 2081 | * whereas passing more than one argument creates a new {@link angular.Module} |
| 2082 | * |
| 2083 | * |
| 2084 | * # Module |
| 2085 | * |
| 2086 | * A module is a collection of services, directives, controllers, filters, and configuration information. |
| 2087 | * `angular.module` is used to configure the {@link auto.$injector $injector}. |
| 2088 | * |
| 2089 | * ```js |
| 2090 | * // Create a new module |
| 2091 | * var myModule = angular.module('myModule', []); |
| 2092 | * |
| 2093 | * // register a new service |
| 2094 | * myModule.value('appName', 'MyCoolApp'); |
| 2095 | * |
| 2096 | * // configure existing services inside initialization blocks. |
| 2097 | * myModule.config(['$locationProvider', function($locationProvider) { |
| 2098 | * // Configure existing providers |
| 2099 | * $locationProvider.hashPrefix('!'); |
| 2100 | * }]); |
| 2101 | * ``` |
| 2102 | * |
| 2103 | * Then you can create an injector and load your modules like this: |
| 2104 | * |
| 2105 | * ```js |
| 2106 | * var injector = angular.injector(['ng', 'myModule']) |
| 2107 | * ``` |
| 2108 | * |
no test coverage detected