Controller之間透過$rootScope.broadcast廣播訊息

摘要:Controller之間透過$rootScope.broadcast廣播訊息

app.controller(xxxxController, function($scope. $rootScope){

          $scope.shareGridData2 = response.dtoList;                        
          $rootScope.$broadcast("Update", $scope.shareGridData2);
});
 
app.controller(yyyController, function($scope) {
        $scope.$on("Update", function(event, shareGridData2) {
                $scope.gridData2 = shareGridData2;
          });
}