solodynamo / ng2-search-filter

Angular 2 / Angular 4 / Angular 5 custom pipe npm module to make a search filter on any input, 🔥 1Million+ downloads
https://www.npmjs.com/package/ng2-search-filter
MIT License
149 stars 40 forks source link

Multiple filters does not work #27

Open sajeetharan opened 6 years ago

sajeetharan commented 6 years ago
<tr *ngFor="let list of doctors | filter:doctorName | filter:clinicName | filter:specialization| paginate: { itemsPerPage: 25, currentPage: p }">
aVolpe commented 6 years ago

Hey @sajeetharan the filter works well with two filters.

First, the filter implement a type of deep search that will search in every single property of you.

If you have a list like this:

    items: any[] = [
      {name: 'archie', lastName: 'test1'},
      {name: 'archie', lastName: 'test4'},
      {name: 'jake', lastName: 'test2'},
      {name: 'richard', lastName: 'test3'}];

And a use like this:

    <input type="text" [(ngModel)]="firstName">
    <input type="text" [(ngModel)]="lastName">
    <div *ngFor="let item of items | filter:firstName | filter:lastName">
        <p>
            {{item.name}} {{item.lastName}}
        </p>
    </div>

And put archie in the first input, and test4 in the second, the list will show you only the second record.

Can you share the relevant pieces of your code to allow us to check it?

aVolpe commented 6 years ago

Also, can you please add your angular and ng2-search filter version?