The following example shows how to pass variables between siblings controllers and take an action when the value changes.
Use case example: you have a filter in a sidebar that changes the content of another view.
angular.module('myApp', [])_x000D_
_x000D_
.factory('MyService', function() {_x000D_
_x000D_
// private_x000D_
var value = 0;_x000D_
_x000D_
// public_x000D_
return {_x000D_
_x000D_
getValue: function() {_x000D_
return value;_x000D_
},_x000D_
_x000D_
setValue: function(val) {_x000D_
value = val;_x000D_
}_x000D_
_x000D_
};_x000D_
})_x000D_
_x000D_
.controller('Ctrl1', function($scope, $rootScope, MyService) {_x000D_
_x000D_
$scope.update = function() {_x000D_
MyService.setValue($scope.value);_x000D_
$rootScope.$broadcast('increment-value-event');_x000D_
};_x000D_
})_x000D_
_x000D_
.controller('Ctrl2', function($scope, MyService) {_x000D_
_x000D_
$scope.value = MyService.getValue();_x000D_
_x000D_
$scope.$on('increment-value-event', function() { _x000D_
$scope.value = MyService.getValue();_x000D_
});_x000D_
});
_x000D_
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>_x000D_
_x000D_
<div ng-app="myApp">_x000D_
_x000D_
<h3>Controller 1 Scope</h3>_x000D_
<div ng-controller="Ctrl1">_x000D_
<input type="text" ng-model="value"/>_x000D_
<button ng-click="update()">Update</button>_x000D_
</div>_x000D_
_x000D_
<hr>_x000D_
_x000D_
<h3>Controller 2 Scope</h3>_x000D_
<div ng-controller="Ctrl2">_x000D_
Value: {{ value }}_x000D_
</div> _x000D_
_x000D_
</div>
_x000D_