* @ngdoc interface * @name angular.Module * @description * * Interface for configuring angular angular.module modules.
(window)
| 1441 | */ |
| 1442 | |
| 1443 | function setupModuleLoader(window) { |
| 1444 | |
| 1445 | var $injectorMinErr = minErr('$injector'); |
| 1446 | var ngMinErr = minErr('ng'); |
| 1447 | |
| 1448 | function ensure(obj, name, factory) { |
| 1449 | return obj[name] || (obj[name] = factory()); |
| 1450 | } |
| 1451 | |
| 1452 | var angular = ensure(window, 'angular', Object); |
| 1453 | |
| 1454 | // We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap |
| 1455 | angular.$$minErr = angular.$$minErr || minErr; |
| 1456 | |
| 1457 | return ensure(angular, 'module', function() { |
| 1458 | /** @type {Object.<string, angular.Module>} */ |
| 1459 | var modules = {}; |
| 1460 | |
| 1461 | /** |
| 1462 | * @ngdoc function |
| 1463 | * @name angular.module |
| 1464 | * @description |
| 1465 | * |
| 1466 | * The `angular.module` is a global place for creating, registering and retrieving Angular |
| 1467 | * modules. |
| 1468 | * All modules (angular core or 3rd party) that should be available to an application must be |
| 1469 | * registered using this mechanism. |
| 1470 | * |
| 1471 | * When passed two or more arguments, a new module is created. If passed only one argument, an |
| 1472 | * existing module (the name passed as the first argument to `module`) is retrieved. |
| 1473 | * |
| 1474 | * |
| 1475 | * # Module |
| 1476 | * |
| 1477 | * A module is a collection of services, directives, filters, and configuration information. |
| 1478 | * `angular.module` is used to configure the {@link AUTO.$injector $injector}. |
| 1479 | * |
| 1480 | * <pre> |
| 1481 | * // Create a new module |
| 1482 | * var myModule = angular.module('myModule', []); |
| 1483 | * |
| 1484 | * // register a new service |
| 1485 | * myModule.value('appName', 'MyCoolApp'); |
| 1486 | * |
| 1487 | * // configure existing services inside initialization blocks. |
| 1488 | * myModule.config(function($locationProvider) { |
| 1489 | * // Configure existing providers |
| 1490 | * $locationProvider.hashPrefix('!'); |
| 1491 | * }); |
| 1492 | * </pre> |
| 1493 | * |
| 1494 | * Then you can create an injector and load your modules like this: |
| 1495 | * |
| 1496 | * <pre> |
| 1497 | * var injector = angular.injector(['ng', 'MyModule']) |
| 1498 | * </pre> |
| 1499 | * |
| 1500 | * However it's more likely that you'll just use |
no test coverage detected
searching dependent graphs…