ng-pipes

a8m/angular-filter for Angular 2

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
ng-pipes
119320.1.56 years ago7 years agoMinified + gzip package size for ng-pipes in KB

Readme

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:
```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:
```html
{{ title | reverse }}
```

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)

  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.

  1. Push your branch to Github.

  1. Create a PR to master.