What is a fast and efficient way to implement the server-side component for an autocomplete feature in an html input box using AngularJS?
I want to implement functionality like we can set a timer task that gets reset after every key stroke, with a .5 second delay. This way if a user types multiple characters fast it doesn't query the index every stroke, only when the user pauses for a second.
Currently, I am using this code-
In Html-
<input class="form-control" ng-model="Search" ng-change="SearchResults(Search)" type="text" />
And My javascript code is-
$scope.SearchResults = function (SearchText) {
$scope.Request = new Request();
$scope.Request.Criteria = "[{Key:'SearchText', Value:'" + SearchText + "'}]";
projectRepository.get($scope.Request.get(), function (data) {
$scope.Projects = data.Data;
$scope.Request.set(data);
})
}
Thanks in advance.