I have a table list with three columns. There are the possibility to sort all columns up an down. When you click on the -Tag then the list will sorted but I'm getting the error message:
Error: $injector:unpr Unknown Provider
Unknown provider: orderbyFilterProvider <-
Here is the Ctrl:
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 don't know where is the problem?!
I have a table list with three columns. There are the possibility to sort all columns up an down. When you click on the -Tag then the list will sorted but I'm getting the error message:
Error: $injector:unpr Unknown Provider
Unknown provider: orderbyFilterProvider <-
Here is the Ctrl:
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 don't know where is the problem?!
Share Improve this question asked Jul 3, 2015 at 12:57 yuroyuro 2,2296 gold badges43 silver badges79 bronze badges 1- Can you give js fiddle link here . Then we can decide what is the problem in easiest way. – Amaranadh Meda Commented Jul 3, 2015 at 13:03
1 Answer
Reset to default 10You need to use camel case its orderBy not orderby in your controller
var orderBy = $filter('orderBy');