I am trying to use $watch
, however it's not firing when I expect it to.
Why is the below code not firing when $scope.string
changes?
$scope.string = 'Hello.';
$scope.timesChanged = 0;
$scope.$watch('string', function (newValue) {
$scope.timesChanged =+ 1;
});
$scope.string = 'How are you';
$scope.string = 'doing today?';
Here's a fiddle