# `angular.module` (API in module `ng` )

Improve this doc

## Description

The `angular.module` is a global place for creating and registering Angular modules. All modules (angular core or 3rd party) that should be available to an application must be registered using this mechanism.

### Module

A module is a collocation of services, directives, filters, and configuration information. Module is used to configure the `$injector`.

    // Create a new module
    var myModule = angular.module('myModule', []);

    // register a new service
    myModule.value('appName', 'MyCoolApp');

    // configure existing services inside initialization blocks.
    myModule.config(function($locationProvider) {
      // Configure existing providers
      $locationProvider.hashPrefix('!');
    });

Then you can create an injector and load your modules like this:

    var injector = angular.injector(['ng', 'MyModule'])

However it's more likely that you'll just use `ngApp` or `angular.bootstrap` to simplify this process for you.

## Usage

    angular.module(name[, requires], configFn);

### Parameters

- `name – {!string} –`

  The name of the module to create or retrieve.

- `requires(optional) – {Array.<string>=} –`

  If specified then new module is being created. If unspecified then the the module is being retrieved for further configuration.

- `configFn – {Function} –`

  Optional configuration function for the module. Same as `Module#config()`.

### Returns

`{module}` –

new module with the `angular.Module` api.