Reputation: 18909
I'm listening to an event within my controller:
$scope.$on('time:update', function(event, args) {
console.log('Update -> ' + args.time);
$scope.time = args.time;
});
My view is not printing {{ time }}
at all, even when devtools shows the console.logs.
What am I missing?
Upvotes: 0
Views: 224
Reputation: 42669
You are missing $scope.$apply()
, as the updates are happening outside of Angular context, $scope.$apply is required.
I guess this is the most common issue people stumble upon when using angular. So anytime one sees data binding not working, calling the $apply method should be the first thing to try :)
Upvotes: 1