The first console.log($scope.message) prints out "a"
The second console.log($scope.message) prints out "b"
However the view remains unchanged showing “a”
What is the issue? Is the second $scope.message assignment creating a different namespace?
The actual code that I am using to trigger a change to the $scope after a Socket.IO event is received. In this instance, $apply seems to work (though not the neatest code), I couldn’t get it to work with the global object.
Sorry for necromancer, but I though it was good to clear this point.
I can’t see global variables in your example. I think global variables are made with $rootScope. Maybe you meant another thing. I just point it because maybe someone come here and get confused with global/local variables.