I have a socket.io event being initialized on connection that is supposed to change value of items inside this controller (it controls chart). But when there is mySocket.on it doesn't work at all, don't render anything in this controller. When I take it out it works just fine. mySocket is a proper function, I'm using it in other controllers without any problems.
.controller('KnobCtrl', ['$scope', function($scope, mySocket) {
$scope.itemsCounter = 0;
$scope.roundValue = 0;
mySocket.on('newConnectionCounter', function (itemsInRoundCounter, valueOfRound) {
$scope.itemsCounter = itemsInRoundCounter;
$scope.roundValue = valueOfRound;
});
$scope.data = {
value: $scope.itemsCounter,
options: {
width: 190,
fgColor: "#FFAB40",
skin: "tron",
thickness: .3,
displayPrevious: false,
readOnly: true,
max: 30,
inputColor: "#ffffff"
}
};
$scope.options = {
width: 150,
fgColor: "#ffec03",
skin: "tron",
thickness: .8,
displayPrevious: false,
readOnly: true,
max: 50
};
$scope.formatOptions = function(data) {
data.formattedOptions = JSON.stringify(data.options).replace(/,/g,"\n");
return data;
};
}]);