Prioe / ngOrderObjectBy

Angular filter to orderBy objects of objects in ngRepeat loops

Home Page:http://justinklemm.com/angularjs-filter-ordering-objects-ngrepeat/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

#Angular orderObjectBy filter

##Synopsis

This filter was created by Justin Klemm because the default Angular orderBy filter fails to sort properly Objects of Objects in the context of ngRepeat.

##Use

Install as Bower dependency: bower install angular-order-object-by.

Include on your Angular module's dependencies:

angular.module('YourModule', ['ngOrderObjectBy'])

Then, in your application views:

<ul>
    <li ng-repeat="object in objects | orderObjectBy: 'criteria' : direction">...</li>
</ul>

Thanks to @diegou work now sorting by children's sudocument's properties is supported:

<ul>
    <li ng-repeat="object in objects | orderObjectBy: 'property.criteria' : direction">...</li>
</ul>

For an example see test/index.html.

##Tests

You need karma, karma-cli, karma-jasmine, phantomjs, karma-phantom-js-launcher and angular-mocks in order to run the tests.

karma start karma.conf.js

##Contributions

Feel free to fork, and submit your pull requests using a feature branch on your fork.

Don't forget to add tests! 😉

About

Angular filter to orderBy objects of objects in ngRepeat loops

http://justinklemm.com/angularjs-filter-ordering-objects-ngrepeat/

License:MIT License


Languages

Language:JavaScript 58.9%Language:HTML 41.1%