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'代替 –