I am trying to build a single page web application using angular.
I have these 3 files below: script.js, index.html and about.html.
I want the about.html to use a service in order to change a shared value (to all the other pages i.e. contact.html) using angular service.
I want this service to have a value (message) that can be access via all the pages and once one page changes this value, all the other pages will be aware of this new value...
for some reason the code below doesn't work for that...
why?
script.js
var scotchApp = angular.module('scotchApp', ['ngRoute']);
scotchApp.config(function($routeProvider) {
  $routeProvider
  .when('/', {
    templateUrl : 'pages/home.html',
    controller  : 'SharedController'
  }) 
  .when('/about', {
    templateUrl : 'pages/about.html',
    controller  : 'SharedController'
  })
  .when('/contact', {
    templateUrl : 'pages/contact.html',
    controller  : 'SharedController'
  });
});
scotchApp.factory('myService', function() {
 var savedData = {}
 function set(data) {
   savedData = data;
 } 
 function get() {
  return savedData;
}
return {
  set: set,
  get: get
}
});
scotchApp.controller('SharedController', ['$scope', 'myService', function($scope, myService) { 
  myService.set('hello');
  $scope.message = myService.get();
}]);
index.html
 <!DOCTYPE html>
 <html>
 <head>
  <script data-require="[email protected]" src="https://code.angularjs.org/1.4.9/angular.js" data-semver="1.4.9">
  </script>
   <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular-route.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.3.1/angular-ui-router.min.js"></script>
  <script src="script.js"></script>
</head>
<body>
  <ul>
    <li><a href="#"><i class="fa fa-home"></i> Home</a></li>
    <li><a href="#about"><i class="fa fa-shield"></i> About</a></li>
    <li><a href="#contact"><i class="fa fa-comment"></i> Contact</a></li>
  </ul>
  <div ng-app="scotchApp" ng-view>
  </div>
</body>
</html>
and about.html
<div class="jumbotron text-center">
    <h1>old value</h1>
    <script type="text/javascript">
        myService.set('hello');
        $scope.message = myService.get();
    </script>
    <p>{{ message }}</p>
</div>
I