Wednesday, 21 August 2013

AngularJs $watch function n,o doesn't work

AngularJs $watch function n,o doesn't work

I haven't been able to find an answer to this, mostly because wording it
is kind of hard. What I have is my new change and old change. I know for a
fact that the old change should be different but it randomly is the same
as the new change. Here is my code:
$scope.$watch(function() { return partNumber }, function(n,o) {
$http.get(afHttp.baseUrl + "/" + $scope.partName + "/" + n)
.success(function(data) {
console.log(n);
console.log(o);
$scope.grid.data = data;
});
});
So I know for a fact the old part is different and I guess updating too
fast perhaps? If I was on part 1 and changed to part 2 it would console
log 2 2. I don't know why can anyone help?

No comments:

Post a Comment