AngularJS-未知提供程序:groupByFilterProvider<;-groupByFilter
我有一个对象数组。我需要按一个字段对数据进行分组,并在HTML表中显示结果 输入:AngularJS-未知提供程序:groupByFilterProvider<;-groupByFilter,angularjs,angularjs-ng-repeat,Angularjs,Angularjs Ng Repeat,我有一个对象数组。我需要按一个字段对数据进行分组,并在HTML表中显示结果 输入: [ { id: "559e2bbc9a496034557d6d84", text: "Data Sources", topParentId: "559e2bbc9a496034557d6d84", topParentText: "Data Sources" }, { id: "559e2bbc9a4960345
[
{
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>
到目前为止,我已经做到了:
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>
团体
标签
{{tag.topparentext}
{{tag.text}
但运行此代码后,我得到了@jhadesdev
orderBy
中提到的未知提供者:groupByFilterProvider是现成的,但不是groupBy
。
它包含在您是否可以共享groupBy
filter声明中您是否包含angular.filter@拉穆勒:我想知道是否有任何内置功能。我没有包括角的-filter@Chandermani:我以为groupBy是现成的。@SharpCoder orderBy是现成的,但groupBy不是