Saturday 12 September 2015

Angular JS Manual Bootstrap Example (Multiple Modules)

<!DOCTYPE html >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Angular JS Manual Bootstrap Example (Multiple Modules)</title>
<script src="lib/angular.js"></script>
<script>
// JavaScript Document
//module1
var app1 = angular.module("myapp1", []);
app1.contoller ("MssgController1", function ($scope) {
    $scope.message = "Angular Auto Bootstrap Mssg1";
}) ;
//module2
var app2 = angular.module("myapp2", [])
app2.controller ("MssgController2", function($scope) {
    $scope.message = "Angular Auto Bootstrap Mssg2";
})
//initiate manual process
angular.element(docuent).ready(function() {
var mssgdiv1 = document.getElementById('mssgdiv1');   

//bootstrap mssgdiv1 for module1 and module2
angular.bootstrap(mssgdiv1, ['myapp1', 'myapp2']);


});


</script>
</head>

<body>
<!--ANGULAR JS MANUAL BOOTSTRAP PROCESS-->
<div id="mssgdiv1">
  <h1>Angular JS Manual bootstrap example with Multiple modules </h1>
  <div ng-controller="MssgController1"> {{message}} </div>
  <div ng-controller="MssgController2"> {{message}} </div>
</div>
</body>
</html>

Angular JS Auto Bootstrap Example with Multiple Modules


<html>
<head>

<title>Angular JS Auto Bootstrap Example</title>
<script src="lib/angular.js"></script>
<script>
// JavaScript Document
//module1
var app1 = angular.module("myapp1", []);
app1.contoller ("MssgController1", function ($scope) {
    $scope.message = "Angular Auto Bootstrap Mssg1";
}) ;
//module2
var app2 = angular.module("myapp2", [])
app2.controller ("MssgController2", function($scope) {
    $scope.message = "Angular Auto Bootstrap Mssg2";
})
//module3 dependent on module1 & module2
angular.module("myapp", ["myapp1", "myapp2"]);

</script>

</head>

<body>
<!--ANGULAR JS AUTO BOOTSTRAP PROCESS-->
<div ng-app="myapp">

<h1>
Angular JS Multiple modules auto bootstrap</h1>
<div ng-controller="MssgController1">
 {{message}} </div>
<div ng-controller="MssgController2">
 {{message}} </div>
</div>
</body>
</html>