0

My <input> tag is associated with an Ajax call via ngChange. What can I do to make sure that every change does not make an Ajax Request? Like ngChange function only executes once the user completes typing and waits for sometime, say 700ms.

I already tried ng-model-options="{debounce: 700}" but even then ngChange is executing for every keystroke.

2
  • try solutions from here Commented Jan 21, 2016 at 5:09
  • @entre Thanks. Solved. I was using AngularJS old version. Commented Jan 21, 2016 at 13:48

1 Answer 1

0

depending on what you're definition is for completes typing, you could use ng-blur. ng-blur fires when a user leaves the input field

Sign up to request clarification or add additional context in comments.

5 Comments

No.. I do not want the user to leave the input field. I am displaying search suggestions based on what the user typed.
@FaizuddinMohammed ok so you're not doing search suggestions?
Yes, I am. That is why I used ngChange on the input field. It's just that the ngChange function is executed too often. Any help on that?
@FaizuddinMohammed is it getting called more than just on a character change?
No, for every character change. And, that's exactly what I want to avoid.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.