* @ngdoc type * @name angular.Module * @module ng * @description * * Interface for configuring angular angular.module modules.
(window)
| 1874 | */ |
| 1875 | |
| 1876 | function setupModuleLoader(window) { |
| 1877 | |
| 1878 | var $injectorMinErr = minErr('$injector'); |
| 1879 | var ngMinErr = minErr('ng'); |
| 1880 | |
| 1881 | function ensure(obj, name, factory) { |
| 1882 | return obj[name] || (obj[name] = factory()); |
| 1883 | } |
| 1884 | |
| 1885 | var angular = ensure(window, 'angular', Object); |
| 1886 | |
| 1887 | // We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap |
| 1888 | angular.$$minErr = angular.$$minErr || minErr; |
| 1889 | |
| 1890 | return ensure(angular, 'module', function() { |
| 1891 | /** @type {Object.<string, angular.Module>} */ |
| 1892 | var modules = {}; |
| 1893 | |
| 1894 | /** |
| 1895 | * @ngdoc function |
| 1896 | * @name angular.module |
| 1897 | * @module ng |
| 1898 | * @description |
| 1899 | * |
| 1900 | * The `angular.module` is a global place for creating, registering and retrieving Angular |
| 1901 | * modules. |
| 1902 | * All modules (angular core or 3rd party) that should be available to an application must be |
| 1903 | * registered using this mechanism. |
| 1904 | * |
| 1905 | * When passed two or more arguments, a new module is created. If passed only one argument, an |
| 1906 | * existing module (the name passed as the first argument to `module`) is retrieved. |
| 1907 | * |
| 1908 | * |
| 1909 | * # Module |
| 1910 | * |
| 1911 | * A module is a collection of services, directives, controllers, filters, and configuration information. |
| 1912 | * `angular.module` is used to configure the {@link auto.$injector $injector}. |
| 1913 | * |
| 1914 | * ```js |
| 1915 | * // Create a new module |
| 1916 | * var myModule = angular.module('myModule', []); |
| 1917 | * |
| 1918 | * // register a new service |
| 1919 | * myModule.value('appName', 'MyCoolApp'); |
| 1920 | * |
| 1921 | * // configure existing services inside initialization blocks. |
| 1922 | * myModule.config(['$locationProvider', function($locationProvider) { |
| 1923 | * // Configure existing providers |
| 1924 | * $locationProvider.hashPrefix('!'); |
| 1925 | * }]); |
| 1926 | * ``` |
| 1927 | * |
| 1928 | * Then you can create an injector and load your modules like this: |
| 1929 | * |
| 1930 | * ```js |
| 1931 | * var injector = angular.injector(['ng', 'myModule']) |
| 1932 | * ``` |
| 1933 | * |
no test coverage detected