垫子表工作完美。有没有一种方法可以添加自动增量索引。我的HTML代码:
<div class="mat-elevation-z8">
<table mat-table [dataSource]="dataSource" matSort>
<ng-container matColumnDef="no">
<th mat-header-cell *matHeaderCellDef> No </th>
<td mat-cell *matCellDef="let element; let i = index;"> {{i+1}} </td>
</ng-container>
<ng-container matColumnDef="Title">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Title </th>
<td mat-cell *matCellDef="let element"> <a (click)="openDescriptionView(element.title, element.imageUrl, element.description)">{{element.title}}</a>
</td>
</ng-container>
<ng-container matColumnDef="destination">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Destination </th>
<td mat-cell *matCellDef="let element"> {{element.destination}} </td>
</ng-container>
<ng-container matColumnDef="startDate">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Start Date </th>
<td mat-cell *matCellDef="let element"> {{element.startDate}}</td>
</ng-container>
<ng-container matColumnDef="endDate">
<th mat-header-cell *matHeaderCellDef mat-sort-header> End …Run Code Online (Sandbox Code Playgroud)