Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ng2-filters

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng2-filters

pipes (filters) for angular 2 templates

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Ng2-Filters

External pipes (filters as called in Angular 1) for Angular 2 template engine

Installation

1- via NPM

npm install ng2-filters

2- via Yarn

yarn add ng2-filters

Setup

  • You can add pipes globally to your app, in your app.module.ts file:
import { CapitalizePipe } from 'ng2-filters';

@NgModule({
  declarations: [
    CapitalizePipe
  ],
  ...
})
  • Or you can add per component:
import { CapitalizePipe } from 'ng2-filters';

@Component({
  pipes: [ CapitalizePipe ]
})

Usage

The cool thing about Angular pipes is that they are easy to use, here's an example:

<p>{{ user.name | capitalize }}</p>

And that's it! wait for Angular to render the results and keep your eye on the console in case some error occurred.

List of Pipes

Here's a list of availabe pipes:

  • capitalize: it will turn every first letter in a word into a capital letter (the expected value is String type, other than that an error will be raised)

  • tofixed: based on the toFixed() method (Default decimals number is 2, the expected value is Number type, other than that an error will be raised)

  • substr: based on the substr() medthod (the expected value is String type, other than that an error will be raised))

  • total: it will return the total for an array of numbers (An error will be raised if one value is not type Number)

  • qoute: it will add a qoutation mark to the value (It will turn the given value into a String)

  • replace: this pipe will the replace the first matching string, example: {{ timestring | replace: 'T': ' ' }}. Note: Default replace value is empty string "".

  • replaceAll: work like replace but the difference that it will replace every matching string.

License

This project is under the MIT license.

Keywords

FAQs

Package last updated on 07 Dec 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc