Skip to content

๐Ÿ” A lightweight Angular search library to filter arrays of strings or objects.

License

Notifications You must be signed in to change notification settings

dkreider/ngx-search-filter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

20 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation


npm npm npm bundle size (minified + gzip) ngx-search-filter PRs All Contributors npm

Important Note: This is a fork of ng2-search-filter that has now been archived. Many thanks to Ankit and all the other contributors.

A lightweight Angular search filter pipe. You can use it with ngFor to filter arrays of strings of objects.

If you find this library useful, please give it a ๐ŸŒŸ.

demo-image

Install โŒ›๏ธ

npm i ngx-search-filter --save
yarn add ngx-search-filter 

Usage ๐Ÿงฒ

Import NgxSearchFilterModule to your module

import { NgModule } from '@angular/core';
import { BrowserModule  } from '@angular/platform-browser';
import { AppComponent } from './app';

import { NgxSearchFilterModule } from 'ngx-search-filter';

@NgModule({
  imports: [
    BrowserModule, 
    NgxSearchFilterModule
  ],
  declarations: [AppComponent],
  bootstrap: [AppComponent]
})
export class AppModule {}

And use pipe in your component after declaring and initializing it in your component:

import { Component } from '@angular/core';

@Component({
  selector: 'example-app',
  template: `
    <div>
        <input type="text" [(ngModel)]="term">
        <div *ngFor = "let item of items | filter:term" >
          <p>
            {{item.name}}
          </p>
        </div>

    </div>  
  `
})

export class AppComponent {
  items: string[] = [{ name: "archie" }, { name: "jake" }, { name: "richard" }];
  term = '';
}

Issues ๐Ÿ›

Found a bug? Want to request a feature? Confused? Or wanna simply comment on how useful this library is?

Open an issue here.

Contributors โœจ

Thanks goes to these wonderful people (emoji key):


Daniel Kreider

๐Ÿ’ป

Ankit Singh

๐Ÿ’ป

This project follows the all-contributors specification.

Contributions of any kind welcome!

License ๐Ÿ“œ

MIT ยฉ dkreider

Credits ๐Ÿงธ

Magnifying glass icons created by Freepik - Flaticon