1

I have the userdata out of my passport implementation and i will show them in the admin panel.

$scope.users = [

{
    "id": "1", 
    "local": [
        {"email": "test1@email.de"},
        {"name": "Holger"}
    ]
},
{
    "id": "2",
    "local": [
        {"email": "test2@email.de"},
        {"name": "Robert"}
    ]
},
{
    "id": "3",
    "facebook": [
        {"email": "test3@email.de"},
        {"name": "Robert"}
    ]
}
]

How can i group / order the data depending on the index?

For example:

local
1 Holger test1@email.de
2 Robert test2@email.de

facebook
3 Robert test3@email.de

and how is it possible to list the array in local or facebook undepending of the index.

http://jsfiddle.net/D9MAB/2/

nofear87
  • 869
  • 2
  • 12
  • 27

1 Answers1

2

EDIT (added display of name and email):

http://jsfiddle.net/D9MAB/4/

<body ng-app="app" ng-controller="projects"> 
Local
<table>
    <tr ng-repeat="(index, user) in users | filter:{local:''}">
        <td>{{user.id}}</td>
        <td ng-repeat="(index, detail) in user.local">{{detail.name}}</td>
        <td ng-repeat="(index, detail) in user.local">{{detail.email}}</td>
    </tr>
</table>
Facebook
<table>
    <tr ng-repeat="(index, user) in users | filter:{facebook:''}">
        <td>{{user.id}}</td>
        <td ng-repeat="(index, detail) in user.facebook">{{detail.name}}</td>
        <td ng-repeat="(index, detail) in user.facebook">{{detail.email}}</td>
    </tr>    
</table>

Slaven Tomac
  • 1,552
  • 2
  • 26
  • 38