All Projects → VadimDez → Ngx Order Pipe

VadimDez / Ngx Order Pipe

Licence: mit
▼ Angular 5+ orderBy pipe

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Ngx Order Pipe

Ng2 Search Filter
Angular 2 / Angular 4 / Angular 5 custom pipe npm module to make a search filter on any input, 🔥 100K+ downloads
Stars: ✭ 137 (-38.84%)
Mutual labels:  pipe, angular4, angular5
Angularconcepts
Key Angular Concepts using Latest Angular version 5
Stars: ✭ 31 (-86.16%)
Mutual labels:  pipe, angular4, angular5
Fusebox Angular Universal Starter
Angular Universal seed project featuring Server-Side Rendering, @fuse-box bundling, material, firebase, Jest, Nightmare, and more
Stars: ✭ 132 (-41.07%)
Mutual labels:  angular4, angular5
Amazing Time Picker
Timepicker (Clock Picker) for Angular 2, Angular 4 and Angular 5, Angular 6, Angular 7 - Compatible with Angular Material
Stars: ✭ 142 (-36.61%)
Mutual labels:  angular4, angular5
Angular5 Iot Dashboard
Multipurpose dashboard admin for IoT softwares, remote control, user interface. Develop your client dashboards in Angular 5 with vast variety of components available.
Stars: ✭ 148 (-33.93%)
Mutual labels:  angular4, angular5
Angular Admin Lte
AdminLte for Angular 2
Stars: ✭ 109 (-51.34%)
Mutual labels:  angular4, angular5
Aspnetcore Angular Universal
ASP.NET Core & Angular Universal advanced starter - PWA w/ server-side rendering for SEO, Bootstrap, i18n internationalization, TypeScript, unit testing, WebAPI REST setup, SignalR, Swagger docs, and more! By @TrilonIO
Stars: ✭ 1,455 (+549.55%)
Mutual labels:  angular4, angular5
Learn Angular From Scratch Step By Step
Angular step by step tutorial covering from basic concepts of Angular Framework to building a complete Angular app using Angular Material components. We will go through the main building blocks of an Angular 7 application as well as the best practices for building a complete app with Angular.
Stars: ✭ 140 (-37.5%)
Mutual labels:  angular4, angular5
Popover
Angular CDK Popover, no default style, examples using @angular/material
Stars: ✭ 156 (-30.36%)
Mutual labels:  angular4, angular5
Amexio.github.io
Amexio is a rich set of Angular 7 (170+) components powered by HTML5 & CSS3 for Responsive Design and with 80+ Material Design Themes, UI Components, Charts, Gauges, Data Point Widgets, Dashboards. Amexio is completely Open Sourced and Free. It's based on Apache 2 License. You can use it in your production grade work today at no cost or no obligation.
Stars: ✭ 163 (-27.23%)
Mutual labels:  angular4, angular5
Sb Admin Bs4 Angular 8
Simple Dashboard Admin App built using Angular 8 and Bootstrap 4
Stars: ✭ 1,931 (+762.05%)
Mutual labels:  angular4, angular5
Angular File Uploader
Angular file uploader is an Angular 2/4/5/6/7/8/9/10 + file uploader module with Real-Time Progress Bar, Responsive design, Angular Universal Compatibility, localization and multiple themes which includes Drag and Drop and much more.
Stars: ✭ 92 (-58.93%)
Mutual labels:  angular4, angular5
Ng2 Flatpickr
Angular 2+ wrapper for flatpickr (https://github.com/chmln/flatpickr)
Stars: ✭ 91 (-59.37%)
Mutual labels:  angular4, angular5
Ng Simple Slideshow
A simple, responsive slideshow for Angular 4+.
Stars: ✭ 119 (-46.87%)
Mutual labels:  angular4, angular5
Springbootangularhtml5
♨️ Spring Boot 2 + Angular 11 + HTML5 router mode + HTTP interceptor + Lazy loaded modules
Stars: ✭ 89 (-60.27%)
Mutual labels:  angular4, angular5
Spring Boot Mongodb Angular Todo App
A Sample App built using Spring Boot, Angular and MongoDB
Stars: ✭ 84 (-62.5%)
Mutual labels:  angular4, angular5
Ngx Daterangepicker Material
Pure Angular 2+ date range picker with material design theme, a demo here:
Stars: ✭ 169 (-24.55%)
Mutual labels:  angular4, angular5
Angular2
Angular 2 Seed
Stars: ✭ 75 (-66.52%)
Mutual labels:  angular4, angular5
Ngx Papaparse
Papa Parse wrapper for Angular
Stars: ✭ 83 (-62.95%)
Mutual labels:  angular4, angular5
Ng2 Pdfjs Viewer
An angular 8 component for PDFJS and ViewerJS (Supports angular 2/4/5/6/7)
Stars: ✭ 150 (-33.04%)
Mutual labels:  angular4, angular5

Angular 5+ Order Pipe

https://www.npmjs.com/package/ngx-order-pipe https://www.npmjs.com/package/ng2-order-pipe Build Status DeepScan Grade

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
{{ 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

import { NgModule } from '@angular/core';
import { BrowserModule  } from '@angular/platform-browser';
import { AppComponent } from './app';

import { OrderModule } from 'ngx-order-pipe';

@NgModule({
  imports: [BrowserModule, OrderModule],
  declarations: [AppComponent],
  bootstrap: [AppComponent]
})
export class AppModule {}

And use pipe in your component

import { Component } from '@angular/core';

@Component({
  selector: 'example',
  template: `
    <ul>
      <li *ngFor="let item of array | orderBy: order">
        {{ item.name }}
      </li>
    </ul> 
  `
})

export class AppComponent {
  array: any[] = [{ name: 'John'} , { name: 'Mary' }, { name: 'Adam' }];
  order: string = 'name';
}

Deep sorting

Use dot 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>

Use OrderPipe in the component

Import OrderPipe to your component:

import { OrderPipe } from 'ngx-order-pipe';

Add OrderPipe to the constructor of your component and you're ready to use it:

constructor(private orderPipe: OrderPipe) {
  console.log(this.orderPipe.transform(this.array, this.order)); // both this.array and this.order are from above example AppComponent
}

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)
<li *ngFor="let item of array | orderBy: order : false : true">
  {{ item.name }}
</li>
  • Switching third parameter to false will do case sensitive comparison to order collection:
<li *ngFor="let item of array | orderBy: order : false : false">
  {{ item.name }}
</li>

Donation

If this project help you reduce time to develop, you can give me a cup of tea :)

paypal

License

MIT © Vadym Yatsyuk

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].