<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/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 rootScope's favorite color is still:</p>
<h1>{{color}}</h1>

<script>
var app = angular.module('myApp', []);
app.run(function($rootScope) {
    $rootScope.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>
// Code goes here

/* Styles go here */

<div>
w3s115-AngularJS RootScope
<br/>
code example:
  <hr>
index.html
  <br/>
  <textarea 
  id='codeoutput' 
  style="width: 100%;height: 300px;background-color: #dffff4;
      font-size: 1em;font-family: Verdana, Arial, Helvetica, sans-serif;
      border: 1px solid black;">
      
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/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 rootScope's favorite color is still:</p>
<h1>{{color}}</h1>

<script>
var app = angular.module('myApp', []);
app.run(function($rootScope) {
    $rootScope.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>

    
  </textarea>

  
  <hr/>
  <iframe 
  allowfullscren="allowfullscren" 
  frameborder="0" 
  src="https://embed.plnkr.co/YDFmY1VEnrxzu9bu9mUn?show=preview" 
  style="height: 400px; width: 100%;">
  </iframe>
  <hr> 
https://www.w3schools.com/angular/angular_scopes.asp
  <hr> 
  201603
</div>