Tag Archives: angularjs modules tutorial

AngularJs Modules


AngularJs Modules : AngularJs Modules works as container for controllers. Controllers are associated with modules.


Example for AngularJs Modules

Let us understand with the following example.
We have created an application named as “myApp” which have the controller named as “myController”.

Name :
Name :
Name : {{ name }}
Email : {{ email }}

Now let us create module


AngularJs Modules Full Example

Example




 

  
Name :
Name :
Name : {{ name }} Email : {{ email }}

Try it ยป

Output :

AngularJs Modules example

AngularJs Modules

Note : You can keep your module and controller javaScript code in external js file. Example module.js and controller.js. Include these file such as

Example



myApp.js will have following code.

var myApp = angular.module("myApp", []);

myController.js will have following code.

 myApp.controller("myController", function($scope) {
    $scope.name = "Tani";
    $scope.email = "tanib@yopemail.com";
});