2017-12-16 14 views
0

における表示データTRにこれは私のテーブルコンポーネントコードngFor同じ列

<table class="table borderless"> 
    <thead class="thead-dark"> 
    <tr> 
     <th scope="col">Roll No</th> 
     <th scope="col">Name</th> 
     <th scope="col">Maths</th> 
     <th scope="col">Physics</th> 
     <th scope="col">Chemistry</th> 
     <th scope="col">Biology</th> 
     <th scope="col">Total_marks</th> 
     <th scope="col">Percentage</th> 
     <th scope="col">Division</th> 
    </tr> 
    </thead> 
    <tbody> 
    <tr *ngFor="let student of students"> 
     <app-table-item [student]="student"></app-table-item> 
    </tr> 
    </tbody> 
</table> 

であり、これは問題がAの後、各反復である

​​

私のテーブル項目コンポーネント符号であります挿入されてから要素が取得されます。このため、私はすべての列を単一の列に入れています。 rollnoと同様に、名前などがrollno列の下に表示されます。ここで何ができるのですか?

答えて

1

無効なHTMLが生成されています。 <td>は、<tr>の直下にある必要があります。あなたは中間の<app-table-item>要素を持っていないかもしれません。

app-table-itemコンポーネントのテンプレートにあるすべてのことが正しければ、おそらくこのコンポーネントは不要です。あなたが本当にそれを維持したい場合は、Thanks..itは!...私はまだ私がやったthat..Butのための別のコンポーネントを必要としないことを知って働い

<tr *ngFor="let student of students" app-table-item [student]="student"> 
</tr> 
+0

[app-table-item]にそのセレクターを変更し、使用します私はこれを介して@inputディレクティブを示す必要があります。 –

関連する問題