Angular Sort/OrderBy Pipe (Angular v5+)
Demo & Code Sample
https://stackblitz.com/edit/angular-sort-orderby-pipe
Install
npm install ngp-sort-pipe --save
Usage
In HTML template
{{ collection | sortBy : asc|desc }} {{ collection | sortBy : asc|desc :column/property_name }}
Arguments
Param | Type | Details |
---|---|---|
collection | array or object |
The collection or array to sort |
order | string |
The Sort Order (asc |
property_name (optional) | string |
Name of Property to sort by |
Import NgpSortModule
to your module
;;; ;
And use pipe in your component
;