2016-03-22 8 views
0

Ich bin stecken, frage mich, wie man Spiele in diesem JSON-Objekt ng-repeat. Ich habe verschiedene Wege mit einigen von ihnen ausprobiert, aber ohne Glück.angular ng wiederholen verschachtelten JSON

<tr ng-repeat="game in game.competition.season.round.match"> 
    <td>{% verbatim %}{{ game["@attributes"].match_id }}{% endverbatim %}</td> 
</tr> 

Wenn ich das ganze Objekt in Verwendung ng-repeat i den Wert des ersten bekommen kann „@attributes“ -Taste kann aber nicht zu den Spielen bekommen.

Jede Hilfe wird sehr geschätzt.

[ 
    { 
    "@attributes": { 
     "id": "1", 
     "name": "World", 
     "last_updated": "2016-03-22 06:22:49" 
    }, 
    "competition": { 
     "@attributes": { 
     "id": "19", 
     "name": "Sony", 
     "area_id": "203", 
     "area_name": "USA", 
     "last_updated": "2016-03-22 09:19:52" 
     }, 
     "season": { 
     "@attributes": { 
      "season_id": "3628", 
      "name": "2016", 
      "start_date": "2016-03-21", 
      "end_date": "2016-04-03", 
      "draw_size": "64", 
      "active": "yes", 
     }, 
     "round": [ 
      { 
      "@attributes": { 
       "round_id": "21868", 
       "title": "1/128 Final", 
       "start_date": "2016-03-22", 
       "end_date": "2016-03-26", 
       "groups": "0", 
       "last_updated": "2016-03-22 06:22:49" 
      }, 
      "match": [ 
       { 
       "@attributes": { 
        "match_id": "155624", 
        "official_start_date": "2016-03-22", 
        "official_start_time": "14:00:00", 
        "actual_start_date": "", 
        "actual_start_time": "", 

       } 
       }, 
       { 
       "@attributes": { 
        "match_id": "155625", 
        "official_start_date": "2016-03-22", 
        "official_start_time": "14:00:00", 
        "actual_start_date": "", 
        "actual_start_time": "", 
        "winner": "yet unknown", 
        "score_A": "", 
        "score_B": "", 
        "status": "Fixture", 
        "drawposition": "38", 
        "person_A_id": "14688", 
       } 
       }, 
       { 
       "@attributes": { 
        "match_id": "155626", 
        "official_start_date": "2016-03-22", 
        "official_start_time": "14:00:00", 
        "actual_start_date": "", 
        "actual_start_time": "", 
        "winner": "yet unknown", 
        "score_A": "", 
        "score_B": "", 
       } 
       }, 
       { 
       "@attributes": { 
        "match_id": "155627", 
        "official_start_date": "2016-03-22", 
        "official_start_time": "14:00:00", 
        "actual_start_date": "", 
        "actual_start_time": "", 
        "winner": "yet unknown", 
        "score_A": "", 
       } 
       }, 
       { 
       "@attributes": { 
        "match_id": "155628", 
        "official_start_date": "2016-03-22", 
        "official_start_time": "14:00:00", 
        "actual_start_date": "", 
        "actual_start_time": "", 
        "winner": "yet unknown", 
        "score_A": "", 
        "score_B": "", 
       } 
       }, 
       { 
       "@attributes": { 
        "match_id": "155629", 
        "official_start_date": "2016-03-22", 
        "official_start_time": "14:00:00", 
        "actual_start_date": "", 
        "actual_start_time": "", 
        "winner": "yet unknown", 
        "score_A": "", 
        "score_B": "", 
       } 
       } 
      ] 
      } 
     ] 
     } 
    } 
    } 
] 
+0

haben Sie versucht, das @ in den Attributen zu entfernen und es erneut versuchen? –

+0

Was ist das gewünschte Ergebnis? – zeroflagL

+0

@zeroflagL Gewünschtes Ergebnis ist, durch Match-Knoten zu wiederholen – 3ND

Antwort

1

sollte so sein,

<table> 
    <tr ng-repeat="game in game[0].competition.season.round[0].match"> 
    <td>{% verbatim %}{{ game["@attributes"].match_id }}{% endverbatim %}</td> 
</tr> 

    </table> 
+0

leider tatsächlich so. Sie haben mehr Arrays hier innerhalb. –

+0

funktioniert leider nicht – 3ND

+0

hier gehen Sie, http://jsbin.com/vopiyesaye/2/edit?html,js,console,output –

Verwandte Themen