Module of AngularJS is defining an application.
The module and it’s container for the different parts of an application.
The module is a container for the application controllers.
Controllers always belong to a module.
Module is created by using the AngularJS function “angular.module”
"FirstApp" parameter refers to an HTML element in which the application will run.
Can add controllers, directives, filters, and more, into AngularJS application.
Add a controller to your application, and refer to the controller with the ng-controller directive:
We talk about more about Controller next Session
AngularJS has a set of built-in directives which can use to add functionality to your application.
In addition, you can easily to use the module to add your own directives to your applications:
Modules and Controllers in Files
In this example, "NewApp.js" contains an application module definition, while "Control.js" contains the controller:
var app = angular.module("NewApp", );
The  parameter in the module definition can be used to define dependent modules.
Without the  parameter, you are not creating a new module, but retrieving an existing one.
Functions can Pollute the Global Namespace
AngularJS modules reduces this problem, by keeping all functions local to the module.
When to Load the Library
While it is common in HTML applications to place scripts at the end of the <body> element, it is recommended that you load the AngularJS library either in the <head> or at the start of the <body>.
This is because calls to angular.module can only be compiled after the library has been loaded.
Required fields are marked *
Get all latest content delivered to your email free.