MCPcopy
hub / github.com/angular-ui/ui-router / setupModuleLoader

Function setupModuleLoader

test/angular/1.4/angular.js:1940–2278  ·  view source on GitHub ↗

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

(window)

Source from the content-addressed store, hash-verified

1938 */
1939
1940function setupModuleLoader(window) {
1941
1942 var $injectorMinErr = minErr('$injector');
1943 var ngMinErr = minErr('ng');
1944
1945 function ensure(obj, name, factory) {
1946 return obj[name] || (obj[name] = factory());
1947 }
1948
1949 var angular = ensure(window, 'angular', Object);
1950
1951 // We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap
1952 angular.$$minErr = angular.$$minErr || minErr;
1953
1954 return ensure(angular, 'module', function() {
1955 /** @type {Object.<string, angular.Module>} */
1956 var modules = {};
1957
1958 /**
1959 * @ngdoc function
1960 * @name angular.module
1961 * @module ng
1962 * @description
1963 *
1964 * The `angular.module` is a global place for creating, registering and retrieving Angular
1965 * modules.
1966 * All modules (angular core or 3rd party) that should be available to an application must be
1967 * registered using this mechanism.
1968 *
1969 * Passing one argument retrieves an existing {@link angular.Module},
1970 * whereas passing more than one argument creates a new {@link angular.Module}
1971 *
1972 *
1973 * # Module
1974 *
1975 * A module is a collection of services, directives, controllers, filters, and configuration information.
1976 * `angular.module` is used to configure the {@link auto.$injector $injector}.
1977 *
1978 * ```js
1979 * // Create a new module
1980 * var myModule = angular.module('myModule', []);
1981 *
1982 * // register a new service
1983 * myModule.value('appName', 'MyCoolApp');
1984 *
1985 * // configure existing services inside initialization blocks.
1986 * myModule.config(['$locationProvider', function($locationProvider) {
1987 * // Configure existing providers
1988 * $locationProvider.hashPrefix('!');
1989 * }]);
1990 * ```
1991 *
1992 * Then you can create an injector and load your modules like this:
1993 *
1994 * ```js
1995 * var injector = angular.injector(['ng', 'myModule'])
1996 * ```
1997 *

Callers 1

publishExternalAPIFunction · 0.70

Calls 5

minErrFunction · 0.70
ensureFunction · 0.70
assertNotHasOwnPropertyFunction · 0.70
invokeLaterFunction · 0.70

Tested by

no test coverage detected