未知提供商:groupByFilterProvider< - groupByFilter [英] Unknown provider: groupByFilterProvider <- groupByFilter

查看:270
本文介绍了未知提供商:groupByFilterProvider< - groupByFilter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有对象的数组。我需要对数据进行分组由一个字段,显示结果在一个HTML表。

I have a array of object. I need to group the data by one field and show the result in an HTML table.

输入:

[
    {
        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"
    }
]

从这个我需要建立一个HTML表这样的(由topParentId分组数据):

Group            |       Tags
Data Sources     |      Data Sources
Applications     |      Applications   Analytics

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

 <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>

但在运行此code后,我得到未知提供商:groupByFilterProvider&LT; - groupByFilter 错误

我使用AngularJs 1.2

推荐答案

作为mentionned由@jhadesdev 排序依据可开箱即用,但不是 GROUPBY
它包括在角过滤

As mentionned by @jhadesdev orderBy is available out of the box, but not groupBy. It is included in angular-filter

这篇关于未知提供商:groupByFilterProvider&LT; - groupByFilter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆