title: Angularjs communication between controllers in different tabs
body: <p>I have controller A which sends some data to shared service and controller B which should read that data. The problem is Controller B is on a different page (on same website) than controller A, i.e. I do smth. on controller A, click button (which sends data to service) and open another page where is controller B which should read data from service. But nothing happens, so my question is can controllers on different pages communicate this way ?</p>
  
  <p>Here is how I tried to do it but with no luck:</p>
  
  <p>Service:</p>
  
  <pre><code>publicApp.angularModule.service('controllerCommunicationService', function ($rootScope) {
      var communicationService = {};
      communicationService.data = null;
  
      communicationService.setDataForBroadcast = function(data) {
          this.data = data;
          this.broadcastData();
      };
  
      communicationService.broadcastData = function() {
          $rootScope.$broadcast('handleBroadcast');
      };
  
      return communicationService;
  });
  </code></pre>
  
  <p>Relevant parts of controller A:</p>
  
  <pre><code>publicApp.angularModule.controller('PublicRoutinesCtrl', function ($scope, $rootScope, routinesService, controllerCommunicationService, bootstrapCarouselService) {
  
  
      $scope.goToNextScreen = function() {
          var currentIndex = bootstrapCarouselService.getcurrentSlideIndex();
          controllerCommunicationService.setDataForBroadcast($scope.items[currentIndex].Routine.RoutineId);
  
  
  
      };
  </code></pre>
  
  <p>Relevant parts of controller B:</p>
  
  <pre><code> $rootScope.$on('handleBroadcast', function () {
          console.log("TEST");
          $http.post("/EditWorkout/PostRoutineId", { routineId: controllerCommunicationService.data })
               .success(function() {
                   console.log("success");
               })
              .error(function (responseData) {
              console.log("Error !" + responseData);
          });
      });
  </code></pre>
  
  <p>And even <code>console.log("TEST");</code> isn't fired.</p>