0

In anguar 5 I referred the below link for sorting.

https://github.com/VadimDez/ngx-order-pipe

But the order which I am getting is improper. Please check the screenshot enter image description here

enter image description here I am using this code in in component:

setOrder(value: string) {
    if (this.order === value) {
      this.reverse = !this.reverse;
    }

    this.order = value;
  }

And in HTML

<thead class="text-primary">

                                <th [class.active]="order === 'theme'"
                      (click)="setOrder('theme')" class="curpointer"  width="40%">
                                    Theme 
                                    <i class="material-icons" *ngIf="order =='theme'">{{ (reverse)?'expand_less':'expand_more' }}</i>
                                </th>
</thead>
<tbody>
<tr *ngFor="let themeData of themeArr | orderBy: order:reverse:'case-insensitive' | filter:filter | paginate: { itemsPerPage: 10, currentPage: p };">


                                       <td>
                                            {{ themeData.title }}
                                        </td>
</tr>
</tbody>

Currently the result is coming but its in an improper format.

I am using angular 5.2.9 I believe we need to sort based on the type. Please guide on the same and help me accordingly.

  • Reproduce using stackblitz – Sajeetharan May 21 '18 at 15:59
  • Possibly this would help :[Angular 5 Sort by date, text, numbers](https://stackoverflow.com/questions/49270859/angular-5-sort-by-date-text-numbers?noredirect=1&lq=1&utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa) – spartans bmk May 21 '18 at 18:22
  • Yes I checked the same before. But it cannot help me out. Can I do something in th setOrder function to manage the same. Please guide accordingly. – Abhranil Majumder May 22 '18 at 08:52

0 Answers0