Ngx-Pipes Useful Pipes For Angular With No External Dependencies
Ngx-pipes is a library with a dozen of Useful pipes for Angular Applications. With this library, there is no need for you to write some basic pipes for your Angular App. It has pipes for strings, array, object manipulations. ```markdown
{{ 'foo' | reverse }} {{ ' foo' | ltrim | reverse }} {{ 'example' | repeat: 3: '@' }} {{'Hey {0}, {1}' | scan: ['foo', 'bar']}}
``` Those are just a few of the awesomeness of this neat module.
How to Use ngx-pipes
Use npm to install the package
$ npm install ngx-pipes --save
You could either add into your module imports the NgPipesModule in order to add all of the pipes, Or add a specific module such as NgArrayPipesModule, NgObjectPipesModule, NgStringPipesModule, NgMathPipesModule or NgBooleanPipesModule.
```javascript import {NgPipesModule} from 'ngx-pipes'; @NgModule({ // ... imports: [ // ... NgPipesModule ] }) ```
Pipes are also injectable and can be used in Components / Services / etc.
```javascript import {ReversePipe} from 'ngx-pipes'; @Component({ // .. providers: [ReversePipe] }) export class AppComponent { constructor(private reversePipe: ReversePipe) { this.reversePipe.transform('foo'); // Returns: "oof" } // .. } ```
You can also use pipes as part of your template for ex.
```markdown
{{ 'foo' | reverse }}