javascript - how sorting do sorting in angular js using filter -


could please tell me how sort column in ascending , descending order when user click on header of each column .i have list in header placed on top .i want sort column using "^" , "v" key .i make directive sort column not work .first image not display image "v" , "^"(not display) , second when click on header column not sorting table in ascending , descending order.

here code http://plnkr.co/edit/wswyugoyazlvua8sxwee?p=preview

.directive('sortheader', function($timeout) {     return {         require: '^headerrow',         restrict: 'e',         scope: {             'label': '@',             'sortstring': '&sortexp',             'idx': '@index'         },         templateurl: 'sort-header.html',         link: function(scope, element, attrs, headerctrl) {             headerctrl.addsortheader(scope);             scope.reverse = false;             element.on('click', function(){                 $timeout(function(){                     scope.reverse = !scope.reverse;                     headerctrl.select(scope);                 });             });         }     }; }); 

template

.run(function($templatecache) {     $templatecache.put('sort-header.html', '<button class="buttonheader button button-clear button-dark fntandbg headerbtnclass columnheaderfontfamily"><i class="icon"  ng-if="label==\'account name\'" ng-class="{\'ion-arrow-down-b\': reverse, \'ion-arrow-up-b\': !reverse}"></i> <strong>{{label}}</strong></button>'); }). 

i able add icon on header text not able sort update plunker http://plnkr.co/edit/wswyugoyazlvua8sxwee?p=preview


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -