AngularJS Modules

1.What is the module?

The module can be treated as a container for the different part of your application like controllers, filters , services, directives , etc. The module is an important part of the Angular js dependency injection system.

 

2.How to create a module?

The module is created by the following syntax:

Syntax:

angular.module("myModule",[]);

 

Here, myModule is the name of the module. and [] is where you inject the dependencies.

 

3.How to create a controller in a module?

Add controller to your application.

synatx:

var myFirstModule = angular.module("myFirstModule", []);
myFirstModule.controller("MyController", function);

 

{ajs-modcontroller}