MCPcopy Create free account
hub / github.com/bclinkinbeard/angular / setupModuleLoader

Function setupModuleLoader

test/fixtures/foo.js:1595–1896  ·  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

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

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