0

I am developing a search option for my web app written in angularjs. The situation now is the following: a request to the backend server is fired with ng-change every time something is typed into the search field, this can lead to an unneccessary amount of calls to the backend..

What is a good way of limiting the amount of search request? I'm thinking of something that waits until the user has stopped typing and then sends the request.

user1354603
  • 4,034
  • 4
  • 31
  • 43

1 Answers1

0

I posted an answer in angular directive encapsulating a delay for ng-change that works. It simplify the search by using a directive.

If you don't like to use a delayed search, you can write your search code on blur of your input box.

Community
  • 1
  • 1
Alborz
  • 6,843
  • 3
  • 22
  • 37