Angular js Module Explained

In the below post we will learn about what is angular js module , how to create/use an angular js Module

An angular js module is a top level component which contains other components like controllers, services filters etc.

Angular js library provide a method “angular.module()” by using you can create a module as below.


Angular js module method takes three parameter which are as below.

name : This is the name of the angular js module which you want to create

requires : This parameter takes name of other modules on which the new module you are creating depends.

config : Configuration of the module which you are creating .


One this you should remember is that if you are creating module then you must pass the require parameter ( as in the above code []) otherwise angular js will try to find module which you created earlier.

for example if I will write “angular.module(“MyDemoApp”)” then angular js will think that I want to find “MyDemoApp” module which I have created earlier.

Now we have created a angular js module to use it you need to add “ng-app” directive on html element on which we want this module to work as below .


In the above code we have applied “MyDemoApp” module to the body of the html document using “ng-app” directive.

the multiplication code is to check whether angular js working fine for my html document or not if it will not work then on browser it will just print what is in the “div” tag otherwise, it will process the written code and print result as “30”. lets browse it.


if all working then it will display as output as above.

Thanks for reading. Happy Coding.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s