0

I have an angular application that is ment to search through 1000+ objects. is tearing on the ui and the application seems slow.

The objects im searching through looks like this:

enter image description here

The current array im searching through is 799 long.

My search method up till now has been an input field with the following:

<input type="text" class="form-control" placeholder="Søg" ng-model="search.$">

As you might have guessed the problem is that im searching in all of the text.

So i attempted to change this to only search in the question field:

<input type="text" class="form-control" placeholder="Søg" ng-model="search.question">

However this did not help much. The UI is still "laggy" when i attempt to write in the search field.

So my question is how do i optimize this search and avoid a laggy ui?

1 Answer 1

2

You didn't write what actually happens when you enter something into the input field. Anyway, instead of searching while the user is typing you can search after she has stopped typing, using ngModelOptions:

<input ng-model-options="{ debounce: 200 }" ng-model="search.question">

This starts the search 200ms after the user has stopped typing.

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

Comments

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.