Reputation: 3068
Angular noob here
I have an angular app in this plunkr.
How do i sort the list displayed here using angular such that the course with the flag always stays on the top and the remaining items are sorted alphabetically?
Upvotes: 0
Views: 188
Reputation: 28750
You can use the orderBy.
Change your ngRepeat to this:
<a ng-repeat="prog in programs | orderBy:'academic_program.program_title' | orderBy:'primary_program':true" href="#" ng-click="display.addprogram = false" class="list-group-item">
Here's the modified plunker: http://plnkr.co/edit/PJBvf5MyGe3ggD2uFkKf?p=preview
Upvotes: 2