1

Html file

<!DOCTYPE html>
<html >
    <head>
        <title>Angular JS Demo</title>
        <script src="scripts/angular.min.js"></script> 
        <script src="scripts/Script_1.js"></script>
        <meta charset="utf-8" />
    </head>
    <body>
        <div  ng-app="HelloWorldApp" ng-controller="HelloWorldController">
            Message: {{ greeting }}
        </div>
        <div id="class2" ng-controller="HelloWorldController1">
           Message: {{ message }}
         </div>
    </body>
</html>

Script_1.js

/// <reference path="angular.min.js" />
angular.module('HelloWorldApp', []).controller("HelloWorldController", function ($scope) {
   $scope.greeting = "Hello World";
});

angular.module('HelloWorldApp1',[]).controller("HelloWorldController1",function ($scope) {
   $scope.message = "Hello World";
});
angular.bootstrap(document.getElementById('class2'), ['HelloWorldApp1']);

The output is 
     Message: Hello World
     Message: {{ message }}

Though I used the angular.bootstrap(document.getElementById('class2',[HelloWorldApp1]); Why it is not bootstrapping.I am new to this anugular js,am I missing any libraries? I am stuck here.Pls help me.

Thank you

Vijay Vj
  • 347
  • 3
  • 15

1 Answers1

0

Try this:

  <!DOCTYPE html>
    <html >
        <head>
            <title>Angular JS Demo</title>
            <script src="scripts/angular.min.js"></script> 
            <script src="scripts/Script_1.js"></script>
            <meta charset="utf-8" />
        </head>
        <body>
            <div  ng-app="HelloWorldApp" ng-controller="HelloWorldController">
                Message: {{ greeting }}
            </div>
            <div id="class2"ng-app="HelloWorldApp1" ng-controller="HelloWorldController1">
               Message: {{ message }}
             </div>
        </body>
    </html>
Rani Radcliff
  • 4,856
  • 5
  • 33
  • 60
  • I've tried it but still displays the same. /// angular.module('HelloWorldApp', []).controller("HelloWorldController", function ($scope) { $scope.greeting = "Hello World"; }); angular.module('HelloWorldApp1', []).controller("HelloWorldController1", function ($scope) { $scope.message = "Hello World 22"; }); angular.element(document).ready(function () { angular.bootstrap(document.getElementById("id2"), ['HelloWorldApp1']); }); my second module is not getting boostrapped. – Vijay Vj Aug 03 '16 at 07:56