angularjs - Using multiple controllers defined via module does not work -


when defining controllers global functions, works fine. when using modules declare , "assign" controllers, first controller used resolve bindings. missing?

<!doctype html> <html> <head/> <body>   <div ng-app="flintstones">     <div ng-controller="flintstonectrl">       <label>name:</label>       <input type="text" ng-model="yourname" placeholder="enter name here">       <hr>       <h1>hello {{yourname}}!</h1>     </div>   </div>   <div ng-app="rumbles">     <div ng-controller="rumblectrl">       <label>name:</label>       <input type="text" ng-model="yourname" placeholder="enter name here">       <hr>       <h1>hello {{yourname}}!</h1>     </div>   </div> </body>  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.min.js"></script> <script>    var flintstones = angular.module("flintstones", []);   flintstones.controller("flintstonectrl", function flintstonectrl($scope) {     $scope.yourname = "fred";   });    var rumbles = angular.module("rumbles", []);   rumbles.controller("rumblectrl", function rumblectrl($scope) {     $scope.yourname = "barney";   });  </script>  </html> 

i think, 1 page can have 1 ng-app default, in case have 2 ng-app definitions.

if have multiple apps in page have manual bootstrapping


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -