Home

Awesome

ng-pipes   NPM version Build status License Join the chat at https://gitter.im/ng-pipes/Lobby

a8m/angular-filter for Angular (2+)

For the AngularJS version of this module, please see angular-filter.

Installation

npm install --save ng-pipes

or

yarn add ng-pipes

Get Started

There are 3 ways of adding ng-pipes to your project:

  1. Import all pipes
  2. Import pipes by module
  3. Declare specific pipes

<a name="all"></a> Import all pipes

import { NgPipesModule } from 'ng-pipes';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    NgPipesModule
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }
<h1>
  {{ title | reverse }}
</h1>

<a name="mod"></a> Import pipes by module

import {BooleanPipesModule, CollectionPipesModule, MathPipesModule, ObjectPipesModule, StringPipesModule} from 'ng-pipes';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BooleanPipesModule,     // imports all pipes of the boolean module
    CollectionPipesModule,  // imports all pipes of the collection module
    MathPipesModule,        // imports all pipes of the math module
    ObjectPipesModule,      // imports all pipes of the object module
    StringPipesModule       // imports all pipes of the string module
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }
<h1>
  {{ title | reverse }}
</h1>

<a name="spe"></a> Declare specific pipes

import { ReversePipe, CeilPipe, ... } from 'ng-pipes';
// ...

@NgModule({
  declarations: [
    AppComponent, ReversePipe, CeilPipe, ...
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }
<h1>
  {{ title | reverse }}
</h1>

Contributing

Submitting a Pull Request (PR)

  1. Clone the project via:
$ git clone https://github.com/a8m/ng-pipes.git
  1. Make your changes in a new git branch:
$ git checkout -b my-cool-branch master
  1. Add your changes, including appropriate test cases.

  2. Push your branch to Github.

  3. Create a PR to master.