Angular HTML Markup - 导致错误的表

时间:2015-11-13 19:15:22

标签: html css html-table

我有一个值foo,此代码使用以下代码正确显示其属性:

<div class="col-md-6">
    <p> {{ foo.name }} </p>
    <p visible = "foo.description"> {{ foo.description }}</p>
    <p> {{foo.tags }} </p>
    <p visible = "foo.instructions"> {{ foo.instructions }} </p>
</div>

它显示四个段落,每个段落的值为foo。 property

但是,当我在下面添加一个表时:

<div class="col-md-6">
    <p> {{ foo.name }} </p>
    <p visible = "foo.description"> {{ foo.description }}</p>
    <p> {{ foo.tags }} </p>
    <p visible = "foo.instructions"> {{ foo.instructions }} </p>
    <table class="table table-hover">
      <thead>
        <tr>
          <th>File Name</th>
          <th>File Type</th>
          <th>File Size</th>
          <th> 3D View </th>
        </tr>
      </thead>
      <tbody>
        <tr ng-repeat-start="file in foo.fileId">
          <td> filler </td>
          <td> filler </td>
          <td> filler</td>
          <td> filler </td>
        </tr>
      </tbody>
    </table>
</div>

现在,值显示为{{foo.description}},而不是显示值。为什么要添加一个简单的表混乱?

1 个答案:

答案 0 :(得分:1)

啊,我想通了。你有一个'ng-repeat-start',但你永远不会结束它。你需要包含一个'ng-repeat-end'。或者,只需使用正常的'ng-repeat',然后您就不必指定开始和结束。这有效:

<div class="col-md-6">
 <p> {{ foo.name }} </p>
 <p visible = "foo.description"> {{ foo.description }}</p>
 <p> {{ foo.tags }} </p>
 <p visible = "foo.instructions"> {{ foo.instructions }} </p>
 <table class="table table-hover">
  <thead>
    <tr>
      <th>File Name</th>
      <th>File Type</th>
      <th>File Size</th>
      <th> 3D View </th>
    </tr>
  </thead>
  <tbody>
    <tr ng-repeat="file in foo.fileId">
      <td> filler </td>
      <td> filler </td>
      <td> filler</td>
      <td> filler </td>
    </tr>
  </tbody>
</table>