我想按升序和降序对方法中的数据进行排序。 这是我的方法。
public get students(): Student[] {
return this._dashboardService.account.students;
}
这是我的component.html代码
<li *ngFor="let stud of students">
<div class="{{stud == selectedStudent && highlightStudent ? 'hoveffect' : ''}}">
<div class="hovlink">
<a (click)="setStudent(stud)">
<img [src]="stud.imageUrl ? getStudentFaceImage(stud.imageUrl) : tempDpImage" />
<!--<span>{{stud.firstName}}</span>-->
</a>
</div>
<h4>{{stud.schoolId}}</h4>
</div>
</li>
如果您知道解决方法,请帮助我。
这是学生班。
export class Student {
public userID: number;
public firstName: string;
public lastName: string;
public schoolId: number;
public schoolName: string;
public classId: number;
public className: string;
public sectionId: number;
public sectionName: string;
public currencyCode: string;
public favImageWithoutCorselCount: number;
public NonfavImageWithoutCorselCount: number;
public photos: listData<any>;
public products: listData<any>;
public packages: listData<any>;
public orders: any;
public downloads: listData<any>;
public offers: listData<any>;
public cart: any;
public supportDetail: SupportDetail;
public timeStamp: any;
public isSibling: number;
public EventName: string;
public QrCode: string;
}