What are AngularJS modules?

Question :

What are AngularJS modules?

AngularJS supports modular approach of programming. AngularJS modules are used to divide or separate the logic such as controllers, services, application etc. and keep the code clean. AngularJS module helps to link many components, so it is just a group of related components.

Generally in most of the applications we have a single entry point (main method) that instantiate and club together different parts of the application. In angularjs applications we don’t have that main method instead we have modules that specify how our application will be structured and bootstrapped.

Modules are defined in separate .js files and name them as per the module.js file, if these are kept in different file. Controllers always belong to a module.

Let us have two modules for an application, and we create them as

Application Module − used to initialize an application with controller(s). Application module is created by using the AngularJS function angular module  

Controller Module − used to define the controller. These refer to the controller with the ng-controller directive. 


CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad