0

I'm trying to leverage "column" as a number and re-use it to define the "colspan" in the following "td".

<table>
    <tr>
        <td ng-repeat="column in columns">
            {{column}}
        </td>
        <td colspan="column">
            Something
        </td>
    </tr>
</table>
2
  • 1
    Maybe ... <td colspan="{{column}}"> Commented Apr 7, 2015 at 16:58
  • @rfornal thanks but no, you can't use {{column}} cause it's outside the loop. Commented Apr 7, 2015 at 20:38

1 Answer 1

1

Not sure if thats what you meant but you can try the following:

<table>
    <tr>
        <td ng-repeat-start="column in columns">
            {{column}}
        </td>
        <td ng-repeat-end colspan="{{column}}">
            Something
        </td>
    </tr>
</table>
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks. Although, if for example "column" is 5, that is going to show 5 times <td colspan="">. Only need 1 <td> and its colspan should be 5.
thats what it is.. 1 td with colspan 5

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.