Angular JS modules means :

  • An AngularJS module defines an application.
  • The module is a container for the different parts of an application like controller, services, filters, directives etc.
  • The module is a container for the application controllers.
  • Controllers always belong to a module.

Angular JS Modules


Here we have a module named “MyApp” and controller for this module is “MyController”.
“MyApp” specifies an HTML element in which the application will run.

      <title>Angular JS Controller</title>
      <script src = ""></script>
      <h2>AngularJS Module Demo</h2>
      <div ng-app="MyApp" ng-controller="MyController">
      	{{ firstName + " " + lastName }}
    var app = angular.module("MyApp", []);
      app.controller("MyController", function($scope){
      	$scope.firstName = "Coderz";
      	$scope.lastName = "Heaven";
      // You can write other functions below
      function demoFunction1(){
      	alert("This is a Demo Function")


You cannot write multiple controllers in one html page. Only the first one will work.


Leave a Reply

Your email address will not be published. Required fields are marked *




Theme by HermesThemes

Copyright © 2018 CoderzHeaven. All Rights Reserved

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.