2015-07-10 9 views
11

Ich habe ein Array von Objekten. Ich muss die Daten nach einem Feld gruppieren und das Ergebnis in einer HTML-Tabelle anzeigen.Unbekannter Anbieter: groupByFilterProvider <- groupByFilter

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

Von diesem Ich brauche eine HTML-Tabelle wie diese (Gruppierung Daten von topParentId) zu erstellen:

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

Bisher habe ich dies getan:

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

Aber nach dem Ausführen dieses Codes bekomme ich Unknown provider: groupByFilterProvider <- groupByFilter Fehler.

Ich bin AngularJS 1.2

+0

enthalten Können Sie teilen "groupBy" Filter Deklaration – Chandermani

+1

Haben Sie angular.filter enthalten? https://github.com/a8m/angular-filter – rmuller

+0

@ruller: Ich habe mich gefragt, ob es eine eingebaute Funktion gibt. Ich habe angular-Filter nicht enthalten – SharpCoder

Antwort

17

Wie erwähnt von @jhadesdev orderBy verwendet, ist aus der Box zur Verfügung, aber nicht groupBy. Es ist in angular-filter

Verwandte Themen