Angularjs:如何在两个div中(行方向)或在模板的两个不同行中填充两个不同的列表?

时间:2018-11-23 20:19:40

标签: angularjs

我有两个不同的列表(每个列表来自不同的API)。如何在AngularJS模板的两个div中(行方向)或两个不同的行中填充数据?

如果不清楚,请通知我。我对此还比较陌生。

1 个答案:

答案 0 :(得分:0)

<div class="container">
  <div class="row">
    <div class="col">
      <table class="table">
  <thead>
    <tr>
      <th scope="col">#</th>
      <th scope="col">api_1</th>
    </tr>
  </thead>
  <tbody>
    <tr ng-repeat="n in api_1">
      <th>{{n.id}}</th>
      <td>{{n.name}}</td>
    </tr>
  </tbody>
</table>
      </div>
      <div class="col">
    <table class="table">
    <thead>
      <tr>
        <th scope="col">#</th>
        <th scope="col">api_2</th>
      </tr>
    </thead>
    <tbody>
      <tr ng-repeat="n in api_2">
        <th>{{n.id}}</th>
        <td>{{n.name}}</td>
      </tr>
    </tbody>
  </table>
    </div>
  </div>
  </div>

朋克:http://plnkr.co/edit/tLehZCkpuo0DL5eLNk8z?p=preview