In the following example, we let the user select from a drop down list the order criteria he/she wants to apply. The we iterate over our results and apply the selected order. Angular is actually reordering the set based on property name matching. As long as the string representing the order criteria matches a property in our iterated elements (person in this example), the magic occurs.
<div>
<h3>Order By:</h3>
<select data-ng-model='selectedSortOrder'
data-ng-options="option for option in ['name', 'lastName', 'age']"
data-ng-init="selectedSortOrder='name'">
</select>
</div>
<div >
<h3>List of results:</h3>
<div ng-repeat="person in results | orderBy:selectedSortOrder">
{{person.name}} {{person.lastName}} - {{person.age}}
</div>
</div>
Note:
Useful links:
Working Example: Plunkr
Pretty blog, so many ideas in a single site, thanks for the informative article, keep updating more article.
ReplyDeletehadoop training in chennai
angularjs training in chennai
This comment has been removed by the author.
ReplyDeleteThanks a lot very much for the high quality and results-oriented help. I won’t think twice to endorse your blog post to anybody who wants and needs support about this area. We are providing AngularJS training in Velachery.
ReplyDeleteFor more details:AngularJS training in chennai
Thanks a lot very much for the high quality and results-oriented help.I won’t think twice to endorse your blog post to anybody who wants and needs support about this area.
ReplyDeleteVisit Us: http://www.zerobugacademy.com/angularjs-training-in-chennai
Marvelous and fascinating article. Incredible things you've generally imparted to us. Much obliged. Simply keep making this kind out of the post.
ReplyDeleteangularjs training in chennai
ReplyDeleteThis blog really very help full for all developers and students thank you for writing this blog and now angularjs 6 very training development language more job opportunities available all development company's thank once.
Angularjs training in chennai | Angularjs training in velachery
ReplyDeleteGood Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging
AngularJs Training in Electronic City
This comment has been removed by the author.
ReplyDeleteNice information.Thanks for sharing with us.
ReplyDeleteAngular JS Online training
Angular JS training in hyderabad
Looking For Flutter App Development Flutter is Google's mobile UI framework for crafting high-quality native interfaces on iOS and Android in record time. With the release of Flutter 1.12 version, the programming language has been updated from Dart 2.5 to Dart 2.7. It is expected to supply excellent development and user experience.
ReplyDeleteThe post is useful and it would really help for those who search for Website Development Company in Bangalore | Web Designing Companies in Bangalore | Web Development Company in Bangalore
ReplyDeleteZinavo Technologies Blog : Website Designing Company in Bangalore | Web Designing Company in Bangalore
Thanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my website
ReplyDeleteangular js online training
best angular js online training
top angular js online training
Nice blog
ReplyDeleteExcellent blog keep sharing more angular certification
ReplyDelete