2

I'm trying to do this in angular:

<tr (each)>
  <td>{{attribute1}}</td>
  <td>{{attribute2}}</td>
  <td>{{attribute3}}</td>
</tr>

But I need a wide TD after each TR with colspan 3 like:

<tr>
   <td colspan="3">Another content for row 1</td>
</tr>

As you can see, the (angular each) is inside the <tr>, for my understanding, there's no way to put the colspan row...

Can you help?

1

1 Answer 1

1

Something simple like this for Angular 1:

<tr ng-repeat-start="item in items">
  <td>{{item.attribute1}}</td>
  <td>{{item.attribute2}}</td>
  <td>{{item.attribute3}}</td>
</tr>
<tr ng-repeat-end>
   <td colspan="3">Another content for row 1</td>
</tr>

here are the docs

https://docs.angularjs.org/api/ng/directive/ngRepeat

Otherwise you need to do something like this for Angular 2

<template *ngFor let-item [ngForOf]="items">
    <tr>
        <td>{{item.attribute1}}</td>
        <td>{{item.attribute2}}</td>
        <td>{{item.attribute3}}</td>
    </tr>
    <tr>
        <td colspan="3">Another content for row 1</td>
    </tr>
</template>
Sign up to request clarification or add additional context in comments.

Comments

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.