I had two test files, each containing a single module.
main.1.js has some controllers.
main.2.js has some directives.
I wanted to be able to use both modules in the same index.html
This finally worked for me after I put a bootstrap statement
for each module in the file defining it.
index.html
<html>
<head>
<script type="text/javascript" src="js/vendor/angular.js"></script>
</head>
<body>
<!-- 1. Filters -->
<div id="app1" ng-controller="filterCtrl">
...
</div>
<!-- 2. Directives -->
<div id="app2">
<anewdirective></anewdirective>
...
</div>
<script type="text/javascript" src="js/main.9.js"></script>
<script type="text/javascript" src="js/main.10.js"></script>
</body>
</html>
main.1.js
var app = angular.module('filterApp', []);
...
angular.bootstrap(document.getElementById("app1"), ["filterApp"]);
main.2.js
var app = angular.module('directiveApp', []);
...
angular.bootstrap(document.getElementById("app2"), ["directiveApp"]);
On Wednesday, December 26, 2012 11:14:26 AM UTC-8, Andy Joslin wrote:
>
> Hi sunith, it's simple:
>
> HTML:
> <div id="app1" ng-controller="app1control">
> <div id="app2" ng-controller="app2control">
>
> JS:
> angular.module("firstApp", []).controller("app1control", function() {...});
> angular.module("secondApp", []).controller("app2control", function()
> {...});
>
> angular.bootstrap(document.getElementById("app1"), ["firstApp"]);
> angular.bootstrap(document.getElementById("app2"), ["secondApp"]);
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.