Supersonic
Supersonic

Reputation: 430

Limit in ng-repeat but search through the whole array

I have a problem with search, I have a ng-init with getAllStudents function which gets all the students from the database and later I am trying to limit it to 10 students in the ng-repeat but when the user searches it should be able to search through all the students in getAllStudents and display them. Currently it doesn't display because of limitTo. Please help.

<main ng-init="getAllStudents()">
    <section ng-repeat="student in getAllStudents() | limitTo: 10 | filter: searchText>
        <div ng-click="showStudent(student.details.id, showStudent.details.name)"></div>
    </section>
</main>

Upvotes: 0

Views: 32

Answers (1)

Sheik Althaf
Sheik Althaf

Reputation: 1605

try to do reorder the filter pipes

ng-repeat="student in getAllStudents() | filter: searchText | limitTo: 10"

Upvotes: 3

Related Questions