Home AngularJS - Sorting data ascending / descending when column is clicked
Reply: 0

AngularJS - Sorting data ascending / descending when column is clicked

user637
1#
user637 Published in April 22, 2018, 12:40 am

I have the following view code:

<tr ng-repeat="c in clients | orderBy:'code'">
    <td>{{c.firstname}} {{c.lastname}}</td>
    <td>{{c.telephone}}</td>
    <td>{{c.location}}</td>
    <td>{{c.code}}</td>
</tr>

I want to change the orderBy:'code' when column is clicked, assume that the user clicked on the column location, i want the orderBy condition to change to 'location' instead of code, and to be in this form

<tr ng-repeat="c in clients | orderBy:'location'">
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.30694 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO