Awesome
ng-pipes
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:
<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
- Any contribution is appreciated.
- If you are planning to add a new pipe (or any other feature), please open an issue before.
- Angular Commit Message Format is preferred.
Submitting a Pull Request (PR)
- Clone the project via:
$ git clone https://github.com/a8m/ng-pipes.git
- Make your changes in a new git branch:
$ git checkout -b my-cool-branch master
-
Add your changes, including appropriate test cases.
-
Push your branch to Github.
-
Create a PR to master.