angularjsng-app

Why do we pass second parameter in angular.bootstrap() as an array?


I am beginner of angularJs , we can initialize the application by manually by using bootstraping concept. such as angular.bootstrap(DOMELEMENT,[MODULENAME]) My question is if we pass multiple values in second parameter like ['App1','App2','App3'] but still we have only target DOM element that we are passing in first parameter ,so what is the use of array in this case ,please someone guide me i have go through the docs as well but didn't my answer. https://docs.angularjs.org/api/ng/function/angular.bootstrap

please help me understand ,thanks


Solution

  • A module contains controllers, directives, filters, services, etc.

    If you want your app to contain all the controllers, directives etc. of 2 separate modules A and B, then you can pass these two modules in the array.

    Or you can create a third module C which has the A and B modules as dependencies, and pass only the module C to bootstrap().