When the output of row.remarks is 1, I want to display it as "passed" and when it's 0, I want it to be displayed as "fail" in the HTML while using mat-table.
HTML
<ng-container matColumnDef="remarks">
<th class="font" mat-header-cell *matHeaderCellDef >Quiz Score</th>
<td class="font" mat-cell *matCellDef="let row" >{{row.remarks}}</td>
</ng-container>`
TypeScript
interface IPost {
id: number;
quiz_id: number;
quiz_title: string;
difficulty: string;
total_points: number;
module_id: number;
created_at: string;
remarks: number;
number_of_correct_answers: number;
quiz_information: {
quiz_title: string;
difficulty: string;
total_points: number;
}
users: {
id: number;
name: string;
}
}
getUserScoreByQuizID(quizID: number){
this.dataService.getUserScoreByQuizID(quizID).subscribe(res=>{
this.postsUser = res.UserScore;
console.log(this.postsUser)
this.dataSource = new MatTableDataSource(this.postsUser);
console.log(res);
this.dataSource.sort = this.sort;
this.dataSource.paginator = this.paginator;
})
}