Reputation: 22171
It sounds that a string
containing some characters like a colon can't be observed by angular's $watch
function.
Here's my plunker reproducing the case (console printing the error when the html page opens): http://plnkr.co/edit/w9ItkHZmy4khzYcWHD2A
How to deal with this issue?
Upvotes: 2
Views: 80
Reputation: 6543
You should use $watch
with a string that represents a property in your scope, and not an actually object.
Just change the $watch
to this:
$scope.$watch('myHourString', function (hour) {
console.log("im ok now");
angular.noop();
});
Upvotes: 3
Reputation: 4935
Try with this :
$scope.$watch('myHourString', function (hour) {
angular.noop();
});
See working plunker here
Upvotes: 1