What Is The Meaning Of The Square Brackets In “.module("modulename", […])” Of Angularjs
I just saw an example of routing in AngularJS. I would like to know the relation ship between dependency 'ngRoute' and module mainApp, in synatx var mainApp = angular.module('mainA
Solution 1:
In angular, when defining a module
(creating it), you pass it the names of other module
s it depends on as an array (in square brackets).
In your example, the mainApp
-module
depends on the ngRoute
-module
, making the components of ngRoute
(directives, services, factories, values...) available for dependency injection for the components in mainApp
. To define a module
that does not depend on any other modules, you pass an empty array ([]
) See the angular documentation for some more info on modules
Post a Comment for "What Is The Meaning Of The Square Brackets In “.module("modulename", […])” Of Angularjs"