MCPcopy Create free account
hub / github.com/EricSimons/ionic-course / setupModuleLoader

Function setupModuleLoader

code/songhop/www/lib/angular/angular.js:1669–1975  ·  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

1667 */
1668
1669function setupModuleLoader(window) {
1670
1671 var $injectorMinErr = minErr('$injector');
1672 var ngMinErr = minErr('ng');
1673
1674 function ensure(obj, name, factory) {
1675 return obj[name] || (obj[name] = factory());
1676 }
1677
1678 var angular = ensure(window, 'angular', Object);
1679
1680 // We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap
1681 angular.$$minErr = angular.$$minErr || minErr;
1682
1683 return ensure(angular, 'module', function() {
1684 /** @type {Object.<string, angular.Module>} */
1685 var modules = {};
1686
1687 /**
1688 * @ngdoc function
1689 * @name angular.module
1690 * @module ng
1691 * @description
1692 *
1693 * The `angular.module` is a global place for creating, registering and retrieving Angular
1694 * modules.
1695 * All modules (angular core or 3rd party) that should be available to an application must be
1696 * registered using this mechanism.
1697 *
1698 * When passed two or more arguments, a new module is created. If passed only one argument, an
1699 * existing module (the name passed as the first argument to `module`) is retrieved.
1700 *
1701 *
1702 * # Module
1703 *
1704 * A module is a collection of services, directives, controllers, filters, and configuration information.
1705 * `angular.module` is used to configure the {@link auto.$injector $injector}.
1706 *
1707 * ```js
1708 * // Create a new module
1709 * var myModule = angular.module('myModule', []);
1710 *
1711 * // register a new service
1712 * myModule.value('appName', 'MyCoolApp');
1713 *
1714 * // configure existing services inside initialization blocks.
1715 * myModule.config(['$locationProvider', function($locationProvider) {
1716 * // Configure existing providers
1717 * $locationProvider.hashPrefix('!');
1718 * }]);
1719 * ```
1720 *
1721 * Then you can create an injector and load your modules like this:
1722 *
1723 * ```js
1724 * var injector = angular.injector(['ng', 'myModule'])
1725 * ```
1726 *

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