Angular2 Sorting Pipe with Object Array

后端 未结 3 1746
余生分开走
余生分开走 2021-01-14 05:01

How to make a sorting pipe in angular2 with an array of objects

Original Problem:

I have a TODOs list, (Todo[ ]) and I want to sort it every time I make

3条回答
  •  抹茶落季
    2021-01-14 05:44

    I've created an OrderBy pipe that supports both single and multi-dimensional arrays. It also supports being able to sort on multiple columns of the multi-dimensional array.

  • {{i}}) {{todo.name}} - {{todo.completed}}
  • This pipe does allow for adding more items to the array after rendering the page, and still sort the arrays with the new items dynamically.

    I have a write up on the process here.

    And here's a working demo: http://fuelinteractive.github.io/fuel-ui/#/pipe/orderby and https://plnkr.co/edit/DHLVc0?p=info

提交回复
热议问题