未知提供者:groupByFilterProvider < - groupByFilter

Sha*_*der 14 angularjs angularjs-ng-repeat

我有一个对象数组.我需要将数据分组为一个字段,并在HTML表格中显示结果.

输入:

[
    {
        id: "559e2bbc9a496034557d6d84",
        text: "Data Sources",
        topParentId: "559e2bbc9a496034557d6d84",
        topParentText: "Data Sources"
    },
    {
        id: "559e2bbc9a496034557d6d83",
        text: "Applications",
        topParentId: "559e2bbc9a496034557d6d83",
        topParentText: "Applications"
    },
    {
        id: "559e2bbc9a496034557d6d82",
        text: "Analytics",
        topParentId: "559e2bbc9a496034557d6d83",
        topParentText: "Applications"
    }
]
Run Code Online (Sandbox Code Playgroud)

从这里我需要创建一个像这样的HTML表(通过topParentId分组数据):

Group            |       Tags
Data Sources     |      Data Sources
Applications     |      Applications   Analytics
Run Code Online (Sandbox Code Playgroud)

到目前为止,我已经这样做了:

 <table class="table table-bordered">
              <thead>
              <tr>
                <th>Group</th>
                <th>Tags</th>
              </tr >
              </thead>
              <tbody>
              <tr ng-repeat="tag in topic.tags | groupBy: 'topParentId'">
                <td>{{tag.topParentText}}</td>
              </tr>
              <tr>
                <td>{{tag.text}}</td>
              </tr>
              </tbody>
            </table>
Run Code Online (Sandbox Code Playgroud)

但运行此代码后,我收到 Unknown provider: groupByFilterProvider <- groupByFilter错误.

我正在使用AngularJs 1.2

Abd*_*oui 19

正如@jhadesdev所提到的那样,开箱orderBy即用,但不是groupBy.它包含在角度滤波器中