我有主题名称和时间,如何按时间排序主题,谢谢任何人帮助我
<tr *ngFor="let days of DaysList">
<th class=" text-white bg-success2">{{ days.DayName }}</th>
<td *ngFor="let subjects of filterItemsOfType(data.SubjectInfo,days.DayName)"><button (click)="deleteConfirm(data._id,subjects._id)" type="button"
class="btn btn-primary btn-block btn-sm"> {{subjects._id.SubjectName}}{{subjects.Time}}</button></td>
</tr>
附在图像下方
https://stackoverflow.com/a/46604776/6133565
不要使用管道...
您可以尝试这样的事情:
ngOnInit() {
this.sortedItems = items.sort((a: any, b: any) =>
new Date(a.date).getTime() - new Date(b.date).getTime()
);
}