Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
ng2-filters
Advanced tools
External pipes (filters as called in Angular 1) for Angular 2 template engine
1- via NPM
npm install ng2-filters
2- via Yarn
yarn add ng2-filters
app.module.ts
file:import { CapitalizePipe } from 'ng2-filters';
@NgModule({
declarations: [
CapitalizePipe
],
...
})
import { CapitalizePipe } from 'ng2-filters';
@Component({
pipes: [ CapitalizePipe ]
})
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.
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.
This project is under the MIT license.
FAQs
pipes (filters) for angular 2 templates
We found that ng2-filters demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.