trs
trs

Reputation: 863

Angular - how to use ng-repeat value as variable

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>

Upvotes: 0

Views: 298

Answers (1)

eladcon
eladcon

Reputation: 5825

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>

Upvotes: 1

Related Questions