{"id":14973280,"url":"https://github.com/vadimdez/ngx-order-pipe","last_synced_at":"2025-05-16T13:03:01.771Z","repository":{"id":16146926,"uuid":"79449949","full_name":"VadimDez/ngx-order-pipe","owner":"VadimDez","description":"▼ Angular 5+ orderBy pipe","archived":false,"fork":false,"pushed_at":"2024-06-16T09:58:11.000Z","size":5106,"stargazers_count":239,"open_issues_count":4,"forks_count":57,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-05-14T14:38:45.683Z","etag":null,"topics":["angular4","angular5","order","pipe"],"latest_commit_sha":null,"homepage":"https://vadimdez.github.io/ngx-order-pipe/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VadimDez.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":["https://paypal.me/vadimdez"]}},"created_at":"2017-01-19T12:12:48.000Z","updated_at":"2025-02-04T10:43:47.000Z","dependencies_parsed_at":"2023-02-19T17:21:32.198Z","dependency_job_id":"80dd3a25-3362-4c29-adff-2c46dc9861a4","html_url":"https://github.com/VadimDez/ngx-order-pipe","commit_stats":{"total_commits":244,"total_committers":15,"mean_commits":"16.266666666666666","dds":"0.24590163934426235","last_synced_commit":"6146e917bdb44d6a4e6c25930e94222c5e5c0045"},"previous_names":["vadimdez/ng2-order-pipe"],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VadimDez%2Fngx-order-pipe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VadimDez%2Fngx-order-pipe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VadimDez%2Fngx-order-pipe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VadimDez%2Fngx-order-pipe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VadimDez","download_url":"https://codeload.github.com/VadimDez/ngx-order-pipe/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254535826,"owners_count":22087398,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular4","angular5","order","pipe"],"created_at":"2024-09-24T13:48:28.852Z","updated_at":"2025-05-16T13:03:01.734Z","avatar_url":"https://github.com/VadimDez.png","language":"TypeScript","funding_links":["https://paypal.me/vadimdez","https://www.paypal.me/vadimdez"],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eAngular 5+ Order Pipe\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/ngx-order-pipe\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/dm/ngx-order-pipe.svg?style=flat\" alt=\"downloads\"\u003e\n  \u003c/a\u003e\n  \n  \u003ca href=\"https://www.npmjs.com/package/ng2-order-pipe\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/dm/ng2-order-pipe.svg?style=flat\" alt=\"downloads\"\u003e\n  \u003c/a\u003e\n  \n  \u003ca href=\"https://deepscan.io/dashboard/#view=project\u0026pid=1752\u0026bid=7519\"\u003e\n    \u003cimg src=\"https://deepscan.io/api/projects/1752/branches/7519/badge/grade.svg\" alt=\"downloads\"\u003e\n  \u003c/a\u003e\n\u003c/a\u003e\n\n\u003e Order your collection by a field\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://cloud.githubusercontent.com/assets/3748453/22164327/08764608-df57-11e6-9c90-075aeca26fd6.gif\" width=\"300\"\u003e\n\u003c/p\u003e\n\n### Demo page\n[https://vadimdez.github.io/ngx-order-pipe/](https://vadimdez.github.io/ngx-order-pipe/)\n\nor see code example\n\n[https://stackblitz.com/edit/ngx-order-pipe](https://stackblitz.com/edit/ngx-order-pipe?embed=1\u0026file=app/app.component.ts)\n\n## Install\n\n```\nnpm install ngx-order-pipe --save\n```\n*For Angular lower than 5 use version `1.1.3`*\n\n## Setup\n\nIn case you're using `systemjs` - see configuration [here](https://github.com/VadimDez/ngx-order-pipe/blob/master/SYSTEMJS.md). Otherwise skip this part.\n\n\n## Usage\n\n##### In HTML template\n\n```html\n{{ collection | orderBy: expression : reverse : caseInsensitive : comparator }}\n```\n\n### Arguments\n\n| Param | Type | Default Value | Details |\n| --- | --- | --- | --- |\n| collection | `array` or `object` |  | The collection or object to sort |\n| expression  | `string` or `string array` |  | The key or collection of keys to determinate order |\n| reverse *(optional)* | `boolean`| false | Reverse sorting order |\n| caseInsensitive *(optional)* | `boolean`| false | Case insensitive compare for sorting |\n| comparator *(optional)* | `Function`|  | Custom comparator function to determine order of value pairs. Example: `(a, b) =\u003e { return a \u003e b ? 1 : -1; }` [`See how to use comparator`](https://github.com/VadimDez/ngx-order-pipe/issues/39) |\n\n\u003cbr/\u003e\n\nImport `OrderModule` to your module\n\n```typescript\nimport { NgModule } from '@angular/core';\nimport { BrowserModule  } from '@angular/platform-browser';\nimport { AppComponent } from './app';\n\nimport { OrderModule } from 'ngx-order-pipe';\n\n@NgModule({\n  imports: [BrowserModule, OrderModule],\n  declarations: [AppComponent],\n  bootstrap: [AppComponent]\n})\nexport class AppModule {}\n\n```\n\nAnd use pipe in your component\n\n```typescript\nimport { Component } from '@angular/core';\n\n@Component({\n  selector: 'example',\n  template: `\n    \u003cul\u003e\n      \u003cli *ngFor=\"let item of array | orderBy: order\"\u003e\n        {{ item.name }}\n      \u003c/li\u003e\n    \u003c/ul\u003e \n  `\n})\n\nexport class AppComponent {\n  array: any[] = [{ name: 'John'} , { name: 'Mary' }, { name: 'Adam' }];\n  order: string = 'name';\n}\n```\n\n### Deep sorting\nUse dot separated path for deep properties when passing object.\n```html\n\u003cdiv\u003e{{ { prop: { list: [3, 2, 1] } } | orderBy: 'prop.list' | json }}\u003c/div\u003e\n```\nResult:\n```html\n\u003cdiv\u003e{ prop: { list: [1, 2, 3] } }\u003c/div\u003e\n```\n\n### Use OrderPipe in the component\nImport `OrderPipe` to your component:\n```typescript\nimport { OrderPipe } from 'ngx-order-pipe';\n```\nAdd `OrderPipe` to the constructor of your component and you're ready to use it:\n\n```typescript\nconstructor(private orderPipe: OrderPipe) {\n  console.log(this.orderPipe.transform(this.array, this.order)); // both this.array and this.order are from above example AppComponent\n}\n```\n\n### Case insensitive / Case sensitive\nCase 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.\nBy default value is set to false.\n\n* Make case insensitive order (Third parameter is `true`)\n```html\n\u003cli *ngFor=\"let item of array | orderBy: order : false : true\"\u003e\n  {{ item.name }}\n\u003c/li\u003e\n```\n* Switching third parameter to `false` will do case sensitive comparison to order collection:\n```html\n\u003cli *ngFor=\"let item of array | orderBy: order : false : false\"\u003e\n  {{ item.name }}\n\u003c/li\u003e\n```\n\n## Donation\nIf this project help you reduce time to develop, you can give me a cup of tea :) \n\n[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.me/vadimdez)\n\n## License\n[MIT](https://tldrlegal.com/license/mit-license) © [Vadym Yatsyuk](https://github.com/vadimdez)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvadimdez%2Fngx-order-pipe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvadimdez%2Fngx-order-pipe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvadimdez%2Fngx-order-pipe/lists"}