title: how to call function of page1(service1.html) controller( ctrl1 ) from another page2(service2.html) controller( ctrl2 ) in angularjs
body: <blockquote>
    <p>I try to call function of page1(service1.html) controller( ctrl1 )
    from another page2(service2.html) controller( ctrl2 ) in angularjs.
    The both page has parent controller (parentctrl). Anyone can give me
    idea for fix this problem..</p>
  </blockquote>
  
  <p><strong>Sample Code:</strong></p>
  
  <pre><code>app.controller("parentctrl", function($scope) {
    $scope.$on('emitdata', function(event, data) {
      $scope.$broadcast('broadcast-data', data);
    });
  });
  
  Page 1 : service1.html
  
  app.controller("ctrl1", function($scope) {
    $scope.$on('broadcast-data', function(event, data) {
      $scope.received = data;
    })
  });
  
  Page 2 : service2.html
  app.controller("ctrl2", function($scope) {
    $scope.emit = function() {
      $scope.$emit('emitdata', {'key': 'uu'});
    };
  });
  </code></pre>