trs
trs

Reputation: 863

How to use ng-repeat to define a table's td colspan? (AngularJS)

Given the following code, how do you define the colspan of that first td to match the number of other "td"s in its table so that it can take the full width of the table?

<table ng-repeat="product in products">
    <tr>
        <td colspan="">
            {{product.name}}
        </td>
    </tr>
    <tr ng-repeat="item in product.items">
        <td ng-repeat="element in item">
            {{element}}
        </td>
    </tr>
</table>

Live code here: http://jsfiddle.net/z37uofqk/

Upvotes: 2

Views: 1427

Answers (1)

brettvd
brettvd

Reputation: 486

I think what you're trying to do is get the column to span the whole table. This is a good way to do that:

<td colspan="100%">
    {{product.name}}
</td>

Upvotes: 2

Related Questions