javascript - Angular : Bootstrap giving error in console -
here code :
<!doctype html> <html> <head> <meta charset="iso-8859-1"> <script type="text/javascript" src="./angular.min.js"></script> <script> var app = angular.module('myapp', []); var app1 = angular.module('myapp1', []); app.controller('myctrl', function($scope) { $scope.firstname = "sparsh"; $scope.lastname = "khandelwal"; }); </script> <title>home page</title> </head> <body> <div ng-app="myapp" ng-init="name='sparsh'"> <div ng-controller="myctrl">{{firstname}}</div> <p> name : <input type="text" ng-model="name"> </p> <h1>hello {{name}}</h1> </div> <div ng-app="myapp1" ng-init="names=['jani','hege','kai']"> <ul> <li ng-repeat="x in names">{{x}}</li> </ul> </div> <script type="text/javascript"> angular.bootstrap(document, ['myapp1','myapp']); </script> </body> </html>
although can see expected output, @ same time facing console error.
here description of error
(while click on url)
it says bootstrapped remove 'myapp' .bootstrap function, didnt work.
please help.
you doing both ng-app
declarations , angular.bootstrap(document, ['myapp1','myapp']);
.
you need choose 1 method, otherwise descripted error of multiple bootstrapped applications.
Comments
Post a Comment