V
V
Vlad Pereguda2017-10-04 17:28:09
Angular
Vlad Pereguda, 2017-10-04 17:28:09

How to create a search in angularjs?

In the js file, I have an array of objects defined (first name, last name, contact (Skype, VK, etc.)). You need to do a search on the records. For example: I enter 'skype' into the input and all records are displayed that have skype in their contacts. That is, the search should be performed on 3 fields. How can this be implemented?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nicholas, 2017-10-04
@healqq

Hang ngChange on input and listen for changes. Preferably with ng-modeloptions={debounce: '500'} at least so that everything does not twitch after each input.
In the change handler, a simple Array.filter with the necessary parameters.
You can also do this through filter , but I don’t really like this option.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question