I am following the tutorial by http://www.w3schools.com/angular/tryit.asp?filename=try_ng_scope_rootscope. I changed rootscope to scope for the first controller. Now it won't list the colors.
Shoudn't it be: Blue Red Red after i made the changes ? <!DOCTYPE html> <html> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> <body ng-app="myApp"> <p>The rootScope's favorite color:</p> <h1>{{color}}</h1> <div ng-controller="myCtrl"> <p>The scope of the controller's favorite color:</p> <h1>{{color}}</h1> </div> <p>The Scope's favorite color is :</p> <h1>{{color}}</h1> <script> var app = angular.module('myApp', []); app.run(function($scope) { $scope.color = 'blue'; }); app.controller('myCtrl', function($scope) { $scope.color = "red"; }); </script> <p>Notice that controller's color variable does not overwrite the rootScope's color value.</p> </body> </html> -- You received this message because you are subscribed to the Google Groups "Angular" 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 https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
