MCPcopy Create free account
hub / github.com/cafebazaar/blacksmith / setupModuleLoader

Function setupModuleLoader

web/static/bower_components/angular/angular.js:1904–2242  ·  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

1902 */
1903
1904function setupModuleLoader(window) {
1905
1906 var $injectorMinErr = minErr('$injector');
1907 var ngMinErr = minErr('ng');
1908
1909 function ensure(obj, name, factory) {
1910 return obj[name] || (obj[name] = factory());
1911 }
1912
1913 var angular = ensure(window, 'angular', Object);
1914
1915 // We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap
1916 angular.$$minErr = angular.$$minErr || minErr;
1917
1918 return ensure(angular, 'module', function() {
1919 /** @type {Object.<string, angular.Module>} */
1920 var modules = {};
1921
1922 /**
1923 * @ngdoc function
1924 * @name angular.module
1925 * @module ng
1926 * @description
1927 *
1928 * The `angular.module` is a global place for creating, registering and retrieving Angular
1929 * modules.
1930 * All modules (angular core or 3rd party) that should be available to an application must be
1931 * registered using this mechanism.
1932 *
1933 * Passing one argument retrieves an existing {@link angular.Module},
1934 * whereas passing more than one argument creates a new {@link angular.Module}
1935 *
1936 *
1937 * # Module
1938 *
1939 * A module is a collection of services, directives, controllers, filters, and configuration information.
1940 * `angular.module` is used to configure the {@link auto.$injector $injector}.
1941 *
1942 * ```js
1943 * // Create a new module
1944 * var myModule = angular.module('myModule', []);
1945 *
1946 * // register a new service
1947 * myModule.value('appName', 'MyCoolApp');
1948 *
1949 * // configure existing services inside initialization blocks.
1950 * myModule.config(['$locationProvider', function($locationProvider) {
1951 * // Configure existing providers
1952 * $locationProvider.hashPrefix('!');
1953 * }]);
1954 * ```
1955 *
1956 * Then you can create an injector and load your modules like this:
1957 *
1958 * ```js
1959 * var injector = angular.injector(['ng', 'myModule'])
1960 * ```
1961 *

Callers 1

publishExternalAPIFunction · 0.85

Calls 5

minErrFunction · 0.85
ensureFunction · 0.85
assertNotHasOwnPropertyFunction · 0.85
invokeLaterFunction · 0.85

Tested by

no test coverage detected