Created
July 14, 2014 03:38
-
-
Save goldalworming/bb389c9ac7f163858e06 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var timeoutPromise; | |
var delayInMs = 2000; | |
$scope.$watch("query", function () { | |
$timeout.cancel(timeoutPromise); //does nothing, if timeout alrdy done | |
timeoutPromise = $timeout(function(){ //Set timeout | |
$scope.loading = true; | |
returnFactory.query($scope.query).then(function (returns) { | |
$scope.returns = returns; | |
$scope.loading = false; | |
}); | |
},delayInMs); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment