2

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/

1 Answer 1

2

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>
Sign up to request clarification or add additional context in comments.

2 Comments

@brettvd thanks that works. Although I'm trying to find a way to use that "element" in elements as a variable elsewhere in the page. So it's more of a Javascript / Angular question really rather than html.
Nice! Didn't know about colspan="100%"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.