angular.filter 的 groupBy filter : 未知提供程序: groupByFilterProvider <- groupByFilter 错误



我是Angular的新手,我需要使用Angular.Filter的groupBy滤波器,但我不确定如何包含它。我遵循此处指定的前两个步骤:https://github.com/a8m/angular-filter#groupby,但无法遵循第三步,即将'angular.filter'添加到您的主模块的依赖项列表中。p>这是我要使用的HTML文件:

<div>
<table style="border-collapse: collapse">
    <thead>
        <tr align="center" style="outline: thin solid black">
            <th style="text-align: center">Review ID</th>
            <th style="text-align: center">Reported Count</th>
            <th style="text-align: center">Type of Review</th>
            <th style="text-align: center">Link to review</th>
            <th style="text-align: center">Expand/Collapse</th>
        </tr>
    </thead>
    <tbody ng-repeat="(key, value) in data | groupBy: 'ResourceId'">
        <tr>
            <td>{{key}}</td>
            <td>{{value.length}}</td>
            <td>type goes here</td>
            <td>view</td>
            <td>expand</td>
        </tr>
   </tbody>
</table>
</div>

错误:[$injector:unpr] Unknown provider: groupByFilterProvider <- groupByFilter

JS文件如下:

var admin = angular.module('admin', ['ngRoute']);
var delayTimer;
admin.config([
  '$routeProvider',
  '$locationProvider',
   function($routeProvider, $locationProvider) {
      $routeProvider
      .when('/reported', {
        templateUrl: 'view/reported_reviews.html',
        controller: 'reportedController'
      })
   }
 ]);

您需要添加Angular-Filter作为依赖项和参考

var admin = angular.module('admin', ['ngRoute','angular.filter']);

参考

<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-filter/0.5.16/angular-filter.js" > </script>

最新更新