http://jsfiddle.net/coma/y52Q2/1/
Controller
app.controller('Main', function ($scope) {
var delay;
var lookup = function() {
console.log($scope.input);
};
$scope.lookup = function() {
clearTimeout(delay);
delay = setTimeout(lookup, 1000);
};
});
View
<div ng-controller="Main">
<input ng-model="input" ng-change="lookup()"/>
</div>
The problem with the up/down attemp is that stopTyping
gets called more times than startTyping
: