Module is a container for different parts of AngularJS application like controllers, filters, services etc.
Most applications have a main method that gets instantiated when the appliation runs for the first time and this method instantiate different parts of the application.
AngularJS doesn't have main method, so it uses module that specifies how an application should be started. The benefits of this approach are following
To create a module, we use angular.module method. It accepts two parameters
var app = angular.module('app', );
In above code snippet, we have defined a module named "app", as the second parameter is blank array so we are instructing AngularJS that this module is not dependent on any another module.
app = angular.module('app', ['app.ui', 'app.chart']);
var app = angular.module('app', ['app.ui', 'app.chart']);
In above code snippet, we have instructed AngularJS that "app" module is depdendent on "app.ui" and "app.chart" module.Views: 4775 | Post Order: 7