MCPcopy Index your code
hub / github.com/binux/qiandao / setupModuleLoader

Function setupModuleLoader

web/static/components/angularjs/angular.js:1586–1886  ·  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

1584 */
1585
1586function setupModuleLoader(window) {
1587
1588 var $injectorMinErr = minErr('$injector');
1589 var ngMinErr = minErr('ng');
1590
1591 function ensure(obj, name, factory) {
1592 return obj[name] || (obj[name] = factory());
1593 }
1594
1595 var angular = ensure(window, 'angular', Object);
1596
1597 // We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap
1598 angular.$$minErr = angular.$$minErr || minErr;
1599
1600 return ensure(angular, 'module', function() {
1601 /** @type {Object.<string, angular.Module>} */
1602 var modules = {};
1603
1604 /**
1605 * @ngdoc function
1606 * @name angular.module
1607 * @module ng
1608 * @description
1609 *
1610 * The `angular.module` is a global place for creating, registering and retrieving Angular
1611 * modules.
1612 * All modules (angular core or 3rd party) that should be available to an application must be
1613 * registered using this mechanism.
1614 *
1615 * When passed two or more arguments, a new module is created. If passed only one argument, an
1616 * existing module (the name passed as the first argument to `module`) is retrieved.
1617 *
1618 *
1619 * # Module
1620 *
1621 * A module is a collection of services, directives, controllers, filters, and configuration information.
1622 * `angular.module` is used to configure the {@link auto.$injector $injector}.
1623 *
1624 * ```js
1625 * // Create a new module
1626 * var myModule = angular.module('myModule', []);
1627 *
1628 * // register a new service
1629 * myModule.value('appName', 'MyCoolApp');
1630 *
1631 * // configure existing services inside initialization blocks.
1632 * myModule.config(['$locationProvider', function($locationProvider) {
1633 * // Configure existing providers
1634 * $locationProvider.hashPrefix('!');
1635 * }]);
1636 * ```
1637 *
1638 * Then you can create an injector and load your modules like this:
1639 *
1640 * ```js
1641 * var injector = angular.injector(['ng', 'myModule'])
1642 * ```
1643 *

Callers 1

publishExternalAPIFunction · 0.85

Calls 4

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

Tested by

no test coverage detected