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”.

Now let us create module

AngularJs Modules Full Example

Example

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.

myController.js will have following code.