In JS, it is unwise to define all of the function code in the global namespace.
In angular, the controller code is encapsulated in the module unit.
In Angularjs, the module is the most important way to define the application, the module contains the main application code,
An application can contain multiple modules, each containing code that defines the specific functionality.
A bit of using the module: 1. You can keep the global namespace clean
2. Apps can load sections of code in any order
Angularjs in the Declaration module: angular.module (name,requires),
The Angular.module () method accepts 2 parameters: the first name (string) is the module
The second require (string array) is a dependency list, a list of string variables, and each element in the list is the name of a module.
This module relies on these modules, which require pre-loading by the injector before the module is loaded.
Use of the Angular.module () method:
1. Angular.module (' myApp ', []); Equivalent to the setter method of the angular module, which defines the module.
2. Angular.module (' myApp '); When passing only one parameter, you can use it to refer to the module, which is equivalent to the getter method of the Angularjs module, which is used to obtain a reference to the module.
ANGULARJS Module--Understanding Summary