ng-pipes
TypeScript icon, indicating that this package has built-in type declarations

0.1.5 • Public • Published

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

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)

  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.

Package Sidebar

Install

npm i ng-pipes

Weekly Downloads

236

Version

0.1.5

License

MIT

Unpacked Size

1.02 MB

Total Files

129

Last publish

Collaborators

  • a8m
  • stevevanopstal