Installations
npm install ngx-order-pipe
Developer Guide
Typescript
No
Module System
ESM
Node Version
20.4.0
NPM Version
9.7.2
Score
96.8
Supply Chain
100
Quality
77
Maintenance
100
Vulnerability
100
License
Releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (77.78%)
HTML (14.78%)
JavaScript (4.83%)
SCSS (2.61%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
Download Statistics
Total Downloads
7,150,034
Last Day
3,526
Last Week
21,497
Last Month
89,930
Last Year
996,250
GitHub Statistics
MIT License
239 Stars
334 Commits
56 Forks
11 Watchers
7 Branches
10 Contributors
Updated on Feb 04, 2025
Bundle Size
2.66 kB
Minified
1.05 kB
Minified + Gzipped
Package Meta Information
Latest Version
3.0.0
Package Id
ngx-order-pipe@3.0.0
Unpacked Size
51.64 kB
Size
12.46 kB
File Count
13
NPM Version
9.7.2
Node Version
20.4.0
Published on
May 18, 2024
Total Downloads
Cumulative downloads
Total Downloads
7,150,034
Last Day
-11.2%
3,526
Compared to previous day
Last Week
-2.5%
21,497
Compared to previous week
Last Month
32.6%
89,930
Compared to previous month
Last Year
-15.6%
996,250
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
Angular 5+ Order Pipe
Order your collection by a field
Demo page
https://vadimdez.github.io/ngx-order-pipe/
or see code example
https://stackblitz.com/edit/ngx-order-pipe
Install
npm install ngx-order-pipe --save
For Angular lower than 5 use version 1.1.3
Setup
In case you're using systemjs
- see configuration here. Otherwise skip this part.
Usage
In HTML template
1{{ collection | orderBy: expression : reverse : caseInsensitive : comparator }}
Arguments
Param | Type | Default Value | Details |
---|---|---|---|
collection | array or object | The collection or object to sort | |
expression | string or string array | The key or collection of keys to determinate order | |
reverse (optional) | boolean | false | Reverse sorting order |
caseInsensitive (optional) | boolean | false | Case insensitive compare for sorting |
comparator (optional) | Function | Custom comparator function to determine order of value pairs. Example: (a, b) => { return a > b ? 1 : -1; } See how to use comparator |
Import OrderModule
to your module
1import { NgModule } from '@angular/core'; 2import { BrowserModule } from '@angular/platform-browser'; 3import { AppComponent } from './app'; 4 5import { OrderModule } from 'ngx-order-pipe'; 6 7@NgModule({ 8 imports: [BrowserModule, OrderModule], 9 declarations: [AppComponent], 10 bootstrap: [AppComponent] 11}) 12export class AppModule {} 13
And use pipe in your component
1import { Component } from '@angular/core'; 2 3@Component({ 4 selector: 'example', 5 template: ` 6 <ul> 7 <li *ngFor="let item of array | orderBy: order"> 8 {{ item.name }} 9 </li> 10 </ul> 11 ` 12}) 13 14export class AppComponent { 15 array: any[] = [{ name: 'John'} , { name: 'Mary' }, { name: 'Adam' }]; 16 order: string = 'name'; 17}
Deep sorting
Use dot separated path for deep properties when passing object.
1<div>{{ { prop: { list: [3, 2, 1] } } | orderBy: 'prop.list' | json }}</div>
Result:
1<div>{ prop: { list: [1, 2, 3] } }</div>
Use OrderPipe in the component
Import OrderPipe
to your component:
1import { OrderPipe } from 'ngx-order-pipe';
Add OrderPipe
to the constructor of your component and you're ready to use it:
1constructor(private orderPipe: OrderPipe) { 2 console.log(this.orderPipe.transform(this.array, this.order)); // both this.array and this.order are from above example AppComponent 3}
Case insensitive / Case sensitive
Case insensitive flag is the third parameter passed to the pipe. Can be true
to make comparison case insensitive and false
to make comparison case sensitive.
By default value is set to false.
- Make case insensitive order (Third parameter is
true
)
1<li *ngFor="let item of array | orderBy: order : false : true"> 2 {{ item.name }} 3</li>
- Switching third parameter to
false
will do case sensitive comparison to order collection:
1<li *ngFor="let item of array | orderBy: order : false : false"> 2 {{ item.name }} 3</li>
Donation
If this project help you reduce time to develop, you can give me a cup of tea :)
License

No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/VadimDez/ngx-order-pipe/main.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/VadimDez/ngx-order-pipe/main.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/VadimDez/ngx-order-pipe/main.yml/master?enable=pin
- Info: 0 out of 3 GitHub-owned GitHubAction dependencies pinned
- Info: 1 out of 1 npmCommand dependencies pinned
Reason
Found 1/6 approved changesets -- score normalized to 1
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/main.yml:1
- Info: no jobLevel write permissions found
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 26 are checked with a SAST tool
Reason
19 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-67mh-4wv8-2f99
- Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx
- Warn: Project is vulnerable to: GHSA-c7qv-q95q-8v27
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
- Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg
- Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p
- Warn: Project is vulnerable to: GHSA-c76h-2ccp-4975
- Warn: Project is vulnerable to: GHSA-4vvj-4cpr-p986 / GHSA-64vr-g452-qvp3
- Warn: Project is vulnerable to: GHSA-9cwx-2883-4wfx
- Warn: Project is vulnerable to: GHSA-vg6x-rcgg-rjx6
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
Score
2.7
/10
Last Scanned on 2025-02-10
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More