Angular sort/orderby pipe, order one dimensional array or an array of objects
npm install ngp-sort-pipehttps://stackblitz.com/edit/angular-sort-orderby-pipe
```
npm install ngp-sort-pipe --save
##### In HTML template
`html`
{{ collection | sortBy : asc|desc }} {{ collection | sortBy : asc|desc :
column/property_name }}
| Param | Type | Details |
| ------------------------ | ------------------- | ------------------------------- |
| collection | array or object | The collection or array to sort |string
| order | | The Sort Order (asc | desc) |string
| property_name (optional) | | Name of Property to sort by |
Import NgpSortModule to your module
`typescript
import { NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { AppComponent } from "./app";
import { NgpSortModule } from "ngp-sort-pipe";
@NgModule({
imports: [BrowserModule, NgpSortModule],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule {}
`
And use pipe in your component
`typescript
import { Component } from "@angular/core";
@Component({
selector: "example",
template:
})
export class AppComponent {
clientScrips = ["html", "css", "javascript", "angular", "react"];
data = [
{ id: 100, name: "Mike" },
{ id: 104, name: "John" },
{ id: 102, name: "David" },
{ id: 101, name: "Jane" },
{ id: 103, name: "Steve" }
];
}
``