【问题标题】:Angular, ng-repeat and rowspan on the same td同一 td 上的 Angular、ng-repeat 和 rowspan
【发布时间】:2016-02-21 19:30:04
【问题描述】:

鉴于此数据:

this.stuff = [
    [{title: 'col1', rowspan: 1},{title: 'col2', rowspan: 2}],
    [{title: 'col3', rowspan: 1}]
];

如何使用 ng-repeat 生成以下内容:

<table border="1">
    <tr>
        <td rowspan="1">col1</td>
        <td rowspan="2">col2</td>
    </tr>
    <tr>
        <td rowspan="1">col3</td>
    </tr>
</table>

【问题讨论】:

    标签: angularjs angularjs-ng-repeat html-table ng-repeat


    【解决方案1】:

    您可以使用以下内容:

    <table border="1">
        <tr ng-repeat="item in stuff">
            <td ng-repeat="obj in item" rowspan="{{ obj.rowspan }}">{{ obj.title }}</td>
        </tr>
    </table>
    

    【讨论】:

      猜你喜欢
      • 2013-11-23
      • 1970-01-01
      • 2016-03-14
      • 1970-01-01
      • 2015-06-19
      • 1970-01-01
      • 1970-01-01
      • 2016-07-07
      • 1970-01-01
      相关资源
      最近更新 更多