ng-pipes
v0.1.5
Published
a8m/angular-filter for Angular 2
Downloads
1,739
Readme
ng-pipes
a8m/angular-filter for Angular2
This module works with Angular 2.x.
For the AngularJS 1.x version of this module, please see angular-filter.
Installation
npm install --save ng-pipes
Get Started
Import ng-pipes to your app.module.ts
import { NgPipesModule } from 'ng-pipes';
// ...
@NgModule({
declarations: [
AppComponent
],
imports: [
// ...
NgPipesModule,
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Inject it to your class(could be Component, Service, etc..), or use it inside the view(template).
app.component.ts
:import { Component } from '@angular/core'; import { RepeatPipe } from 'ng-pipes'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'], providers: [RepeatPipe], }) export class AppComponent { constructor(private repeater: RepeatPipe) { this.repeater = repeater; } title = "hello world" manyTitles = this.repeater.transform(this.title, 10, " "); }
app.component.html
:<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.