3

I have the following:

<div>
  <ul>
    <li *ngFor="let item of array | orderBy: 'type'">
      {{ item.type | translate }}
    </li>
  </ul>
</div>

The i18n translation is made inside the li block. Then, no matter what the translation is, the orderBy pipe does not care of the language to sort the array.

How can I order in the specific language?

  • do something like: let item of array | translate: 'type' | orderBy: 'type'
  • use the translate pipe into the orderBy pipe
  • translate the array in the controller and then use the orderBy sort
Roman C
  • 49,761
  • 33
  • 66
  • 176
louis amoros
  • 2,418
  • 3
  • 19
  • 40
  • why don't you write your custom pipe using pipe transform and implement logic for both these pipes in a single one like one in this link http://stackoverflow.com/questions/35144821/angular-2-use-pipes-in-services. – Rahul Singh May 04 '17 at 11:01

0 Answers0