API連接良好並顯示顯示數據,現在面臨將數據格式化到表格中的問題。 使用ng-repeat =「項目中的項目」, 如果在tr中使用,那麼只有1行顯示,如果在tbody中使用,則其重複tbody。格式化顯示來自angularjs的數據
HTML代碼
<tbody ng-repeat="item in itemsc">
<tr >
<th width="15%">Country</th>
<td width="85%">{{item.name}}</td>
</tr>
<tr>
<th>Flag</th>
<td>
<img ng-src="/assets/images/f/{{item.iso2 | lowercase}}.png" />
</td>
</tr>
<tr>
<th>Capital</th>
<td>{{item.capital}}</td>
</tr>
<tr>
<th>Region</th>
<td>{{item.region}}</td>
</tr>
<tr>
<th>Region</th>
<td>{{item.subRegion}}</td>
</tr>
<tr>
<th>GPS</th>
<td>Latitude: {{item.latitude}} | Longitude: {{item.longitude}}</td>
</tr>
</tbody>
保持這樣的數據格式。 國家,國旗,地區,地區,GPS是靜態的。
> -------------------------------
| Country | Value |
> -------------------------------
| Flag | Value |
> -------------------------------
| Catpital | Value |
> -------------------------------
| Region | Value |
> -------------------------------
| GPS | Value |
> -------------------------------
把'NG-repeat'的'table'代替 –