AngularJS - 未知提供者:groupByFilterProvider <- groupByFilter [英] AngularJS - Unknown provider: groupByFilterProvider <- groupByFilter
问题描述
我有一个对象数组.我需要按一个字段对数据进行分组,并将结果显示在 HTML 表格中.
输入:
<预><代码>[{id: "559e2bbc9a496034557d6d84",文本:数据源",topParentId: "559e2bbc9a496034557d6d84",topParentText: "数据源"},{id: "559e2bbc9a496034557d6d83",文本:应用程序",topParentId: "559e2bbc9a496034557d6d83",topParentText: "应用程序"},{id: "559e2bbc9a496034557d6d82",文字:分析",topParentId: "559e2bbc9a496034557d6d83",topParentText: "应用程序"}]由此我需要创建一个这样的 HTML 表格(按 topParentId 对数据进行分组):
组 |标签数据来源 |数据源应用 |应用分析
到目前为止,我已经这样做了:
<头><tr><th>组</th><th>标签</th></tr ></thead><tr ng-repeat="topic.tags 中的标签 | groupBy: 'topParentId'"><td>{{tag.topParentText}}</td></tr><tr><td>{{tag.text}}</td></tr></tbody>
但在运行此代码后,我收到 Unknown provider: groupByFilterProvider <- groupByFilter
错误.
我使用的是 AngularJs 1.2
正如@jhadesdev 所提到的,orderBy
是开箱即用的,但不是 groupBy
.它包含在 angular-filter
I have a array of object. I need to group the data by one field and show the result in an HTML table.
INPUT :
[
{
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"
}
]
From this I need to create an HTML table like this (grouping data by topParentId):
Group | Tags
Data Sources | Data Sources
Applications | Applications Analytics
So far I have done this:
<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>
But after running this code, I am getting Unknown provider: groupByFilterProvider <- groupByFilter
error.
I am using AngularJs 1.2
As mentionned by @jhadesdev orderBy
is available out of the box, but not groupBy
.
It is included in angular-filter
这篇关于AngularJS - 未知提供者:groupByFilterProvider <- groupByFilter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!