Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
23
rated 0 times [  25] [ 2]  / answers: 1 / hits: 143263  / 12 Years ago, fri, october 12, 2012, 12:00:00

I'm trying to add two angular apps / modules to one page.
In the fiddles below you can see that always only the first module, referenced in the html code, will work correctly, whereas the second is not recognized by angular.



In this fiddle we can only execute the doSearch2 method, whereas in this fiddle only the doSearch method works correctly.



I'm looking for the way how to correctly place two angular modules into one page.


More From » angularjs

 Answers
42

Only one AngularJS application can be auto-bootstrapped per HTML document. The first ngApp found in the document will be used to define the root element to auto-bootstrap as an application. To run multiple applications in an HTML document you must manually bootstrap them using angular.bootstrap instead. AngularJS applications cannot be nested within each other.
-- http://docs.angularjs.org/api/ng.directive:ngApp




See also




[#82591] Wednesday, October 10, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
minab

Total Points: 701
Total Questions: 104
Total Answers: 91

Location: Saint Pierre and Miquelon
Member since Fri, Jan 28, 2022
2 Years ago
;