I have several controllers. In one of them, i need to open web socket connection. In another i need to listen messages and if needed update $scope. Please help me do that on example below:
app.controller('MainCtrl', ['$scope', function($scope) {
$scope.testProp = {};
$scope.testProp2 = '';
// listen messages here
// and update $scope.testProp && $scope.testProp2
}]);
app.controller('SearchCtrl', ['$scope', function($scope) {
// open connection here
}]);
P.S. i understand that the problem is trivial, but i am new in AngularJS and WebSockets, i need help, and now i don't have time for learn docs (what will i do later)