I was wondering whether or not it is possible to implement a slight delay on $scope.$watch. I have the following which queries the server, so I\'d like to implement a slight del
You can use the current value of query
to decide when you want to fire the call:
$scope.$watch("query", function (value) {
//implement rule here for value
//example value is at least 3 characters
if (value && value.length > 3) {
$scope.loading = true;
returnFactory.query($scope.query).then(function (returns) {
$scope.returns = returns;
$scope.loading = false;
});
}
});