MCPcopy Index your code
hub / github.com/angular-ui/ui-router / setupModuleLoader

Function setupModuleLoader

test/angular/1.3/angular.js:1696–2009  ·  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

1694 */
1695
1696function setupModuleLoader(window) {
1697
1698 var $injectorMinErr = minErr('$injector');
1699 var ngMinErr = minErr('ng');
1700
1701 function ensure(obj, name, factory) {
1702 return obj[name] || (obj[name] = factory());
1703 }
1704
1705 var angular = ensure(window, 'angular', Object);
1706
1707 // We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap
1708 angular.$$minErr = angular.$$minErr || minErr;
1709
1710 return ensure(angular, 'module', function() {
1711 /** @type {Object.<string, angular.Module>} */
1712 var modules = {};
1713
1714 /**
1715 * @ngdoc function
1716 * @name angular.module
1717 * @module ng
1718 * @description
1719 *
1720 * The `angular.module` is a global place for creating, registering and retrieving Angular
1721 * modules.
1722 * All modules (angular core or 3rd party) that should be available to an application must be
1723 * registered using this mechanism.
1724 *
1725 * When passed two or more arguments, a new module is created. If passed only one argument, an
1726 * existing module (the name passed as the first argument to `module`) is retrieved.
1727 *
1728 *
1729 * # Module
1730 *
1731 * A module is a collection of services, directives, controllers, filters, and configuration information.
1732 * `angular.module` is used to configure the {@link auto.$injector $injector}.
1733 *
1734 * ```js
1735 * // Create a new module
1736 * var myModule = angular.module('myModule', []);
1737 *
1738 * // register a new service
1739 * myModule.value('appName', 'MyCoolApp');
1740 *
1741 * // configure existing services inside initialization blocks.
1742 * myModule.config(['$locationProvider', function($locationProvider) {
1743 * // Configure existing providers
1744 * $locationProvider.hashPrefix('!');
1745 * }]);
1746 * ```
1747 *
1748 * Then you can create an injector and load your modules like this:
1749 *
1750 * ```js
1751 * var injector = angular.injector(['ng', 'myModule'])
1752 * ```
1753 *

Callers 1

publishExternalAPIFunction · 0.70

Calls 4

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

Tested by

no test coverage detected