Angular2 Component which renders 2 tr elements in a loop

后端 未结 1 1895
一向
一向 2021-01-21 04:28

I need to write a component that has a template that looks like this:

...
...

This must be used with

相关标签:
1条回答
  • 2021-01-21 05:05

    Suggestion as per comment, not tested.

    Component selector: [spot-row]

    Component template:

    <tr>...</tr>
    <tr>...</tr>
    

    HTML:

    <table>
       <tbody *ngFor="let spot of spots" spot-row [spot]="spot"></tbody>
    <table>
    

    This should produce:

    <table>
       <tbody>
         <tr>...</tr>
         <tr>...</tr>
       </tbody>
       <tbody>
         <tr>...</tr>
         <tr>...</tr>
       </tbody>
       ...
    </table>
    

    Which is valid (multiple <tbody> in <table>).

    0 讨论(0)
提交回复
热议问题