Skip to content

dinusuresh/ng2-search-filter

This branch is 55 commits behind solodynamo/ng2-search-filter:master.

Repository files navigation

Angular2 Search Filter Pipe

npm version

Filter search items

Angular 2 filter to make custom search.

demo-image

Install

npm i ng2-search-filter --save

Usage

In case you're using systemjs - see configuration here.

Import Ng2SearchPipeModule to your module

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

import { Ng2SearchPipeModule } from 'ng2-search-filter';

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

And use pipe 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" }];
}

License

MIT © Solodynamo

About

Angular 2 custom pipe npm module to make a search filter on any input.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 81.9%
  • TypeScript 18.1%