admin管理员组文章数量:1312865
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');
本文标签: javascriptSorting filter 39orderBy39 doesn39t work in AngularJSStack Overflow
版权声明:本文标题:javascript - Sorting filter 'orderBy' doesn't work in AngularJS - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741904457a2404060.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论