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?

Module is created by the following syntax:




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.


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


<!DOCTYPE html>
<script src="http://ajax.googleapis.com/
<div ng-app="myFirstModule " ng-controller="MyController">
{{ firstName + " " + lastName }}
var FirstModule = angular.module("myFirstModule ", []);
FirstModule .controller("MyController", function($scope) { $scope.firstName = "Ebc"; $scope.lastName = "Learn";