Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
ng2-order-pipe
Advanced tools
Order your collection by a field
https://vadimdez.github.io/ng2-order-pipe/
npm install ng2-order-pipe --save
{{ collection | orderBy: expression : reverse }}
Param | Type | Details |
---|---|---|
collection | array or object | The collection or object to sort |
expression | string | The key to determinate order |
reverse (optional) | boolean | Reverse sorting order |
Import Ng2OrderModule
to your module
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app';
import { Ng2OrderModule } from 'ng2-order-pipe';
@NgModule({
imports: [BrowserModule, Ng2OrderModule],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule {}
And use pipe in your component
import { Component } from '@angular/core';
@Component({
selector: 'example',
template: `
<div>
<ul>
<li *ngFor="let item of array | orderBy: order">
{{ item.name }}
</li>
</ul>
</div>
`
})
export class AppComponent {
array: any[] = [{ name: 'John'} , { name: 'Mary' }, { name: 'Adam' }];
order: string = 'name';
}
Use comma separated path for deep properties when passing object.
<div>{{ { prop: { list: [3, 2, 1] } } | orderBy: 'prop.list' | json }}</div>
Result:
<div>{ prop: { list: [1, 2, 3] } }</div>
0.1.5
[#10] - Deep properties support
Example
<div>{{ { prop: { list: [3, 2, 1] } } | orderBy: 'prop.list' | json }}</div>
Result
<div>{ prop: { list: [1, 2, 3] } }</div>
FAQs
Angular2 order pipe, order collection by a field
The npm package ng2-order-pipe receives a total of 1,205 weekly downloads. As such, ng2-order-pipe popularity was classified as popular.
We found that ng2-order-pipe 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.