AngularJS Tutorial 6 - Modules

Pubblicato il: 15 agosto 2016
sul canale di: Nisha Singla
1,798
30

In this video we are going to cover Modules in angularJS.
Modules are one of the most important part of any angularJS application. Modules act like a container for different parts of your application like routes, controller, filters,directives,services etc.

How to create Module

var app = angular.module("mainApp",[]);
Creating module is quiet easy and straight forward. So to create module you need to use angular object's module method.
module method takes two parameter- first parameter is the name of the module and second the list of dependencies.
Module may have dependency on another modules, so you need to pass all module names in second parameter on which your main module is dependent.
If you module is not dependent on any other modules , you need to pass empty array in 2nd parameter of module() method.

How to use module in shell page

Now to refer your "mainApp" module in shell page so that all the associated controllers,filters,directives can load as soon as your angular will load you need to use this module in ng-app directive

ng-app = "mainApp"

Further in the coming videos we will bind controllers on this module

To visit all my videos on angularJS Please visit this link:

   • AngularJS Tutorial 1  -  Introduction  


In questa pagina del sito puoi guardare il video online AngularJS Tutorial 6 - Modules della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Nisha Singla 15 agosto 2016, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 1,798 volte e gli è piaciuto 30 spettatori. Buona visione!