I am experiencing an issue with sorting a table list that has three columns. I have implemented the ability to sort all columns in ascending and descending order. However, when I click on the -Tag to initiate the sorting process, I encounter the following error message:
Error: $injector:unpr Unknown Provider
Unknown provider: orderbyFilterProvider <-
This is the code for the controller:
var orderby = $filter('orderby');
$scope.sortType = '-maxAge';
$scope.sortReverse = false;
$scope.order = function (sortType, sortReverse) {
$scope.nameslist = orderby($scope.nameslist, sortType, sortReverse);
};
The view (header):
...
<th>
<a href="" ng-click="sortReverse = !sortReverse; order('fname',reverse)">
Firstame
<span ng-show="sortType=='fname' && !sortReverse" class="glyphicon glyphicon-triangle-bottom"></span>
<span ng-show="sortType=='fname' && sortReverse" class="glyphicon glyphicon-triangle-top"></span>
</a>
</th>
...
The view (table list):
<tr ng-repeat="item in filteredNames = (nameslist | orderBy: sortType:sortReverse)" class="show-cursor">
<td>{{ item.fname }}</td>
...
</tr>
I am puzzled as to where the problem lies. Can anyone help me troubleshoot this?!