Angular 如何在表格单元格中添加多个值?
我目前有一个材料表,如下所示:Angular 如何在表格单元格中添加多个值?,angular,angular-material,Angular,Angular Material,我目前有一个材料表,如下所示: <table mat-table [dataSource]="blogPosts"> <!-- Title Column --> <ng-container matColumnDef="title"> <th mat-header-cell *matHeaderCellDef>Title</th> <td mat-cell *matCellDef="let element"
<table mat-table [dataSource]="blogPosts">
<!-- Title Column -->
<ng-container matColumnDef="title">
<th mat-header-cell *matHeaderCellDef>Title</th>
<td mat-cell *matCellDef="let element">{{ element.title }}</td>
</ng-container>
<!-- Author Column -->
<ng-container matColumnDef="author">
<th mat-header-cell *matHeaderCellDef>Author</th>
<td mat-cell *matCellDef="let element">{{ element.author }}</td>
</ng-container>
<!-- Country Column -->
<ng-container matColumnDef="country">
<th mat-header-cell *matHeaderCellDef>Country</th>
<td mat-cell *matCellDef="let element">{{ element.country }}</td>
</ng-container>
<!-- Link Column -->
<ng-container matColumnDef="link">
<th mat-header-cell *matHeaderCellDef>Links</th>
<td mat-cell *matCellDef="let element"><a href="{{element.link}}"><i class="material-icons">link</i></a></td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
</table>
标题
{{element.title}
作者
{{element.author}
国家
{{element.country}
链接
这将在Links标题下仅显示一个链接,但要显示多个值,我需要做什么,例如:
链接
链接
你不应该直接在
中嵌套,它们应该立即在
中嵌套。如果您希望每个链接都有自己的
,那么您应该检查
链接
你不应该直接在
中嵌套,它们应该立即在
中嵌套。如果您希望每个链接都有自己的
,那么您应该检查一下为什么不将它们添加到同一单元格中?使用新td将它们添加到同一单元格中似乎不起作用(如上一个代码片段中所示),为什么不将它们添加到同一单元格中?使用新td将它们添加到同一单元格中似乎不起作用(如最后一段所示)
<ng-container matColumnDef="link">
<th mat-header-cell *matHeaderCellDef>Links</th>
<td mat-cell *matCellDef="let element">
<a href="{{element.linkToWiki}}"><i class="material-icons">Wiki link</i></a>
<a href="{{element.linkToAmazon}}"><i class="material-icons">Amazon link</i></a>
</td>
</ng-container>