AngularJS Tutorial 15 - Sorting in AngularJS

preview_player
Показать описание
In this tutorial, we are going to learn about Sorting in angularJS
If you want to implement sorting in your application, using angularJS, then its quiet easy- all you need to use a built-in filter ORDERBY filter.

orderBy filter is ued to implement sorting in angularJS, with orderBy you can arraynge data in ascending or descending order

{{orderBy_expression | orderBy : expression : reverse }}

orderBy filter takes 2 arguments:
1) expression: it is used to determine the order
2) reverse : it is used to reverse the sorting order
By default, items are sorted in ascending order

You can change the sorting order by setting second argument reverse to true - by default is false
Setting the value to true means it will arrange the data in descending order

There is one another way through which you can control the sorting direction, by prefix your expression with "+" or "-" .By default it is + - means it will arrange in ascending order, if you will mention "-" then it will reverse the sorting order (means in descending order)

AngularJS ordery filter made sorting quiet easy as compared to JavaScript - thanks to angularJS

Click on this link to watch all videos of angularjs:

Click on this link to follow me on my facebook page:
Рекомендации по теме
Комментарии
Автор

I implemented this into my code but it asked for the pipe.
The pipe 'orderBy' could not be found.

TravelWithSKJ
Автор

creating tutorials on new version angular 4 or 5

SurajTiwarisuru