我需要检查ques.id以及传递给component.ts的ID,并在匹配时出示我的垫子卡。但现在可以了
<mat-card *ngFor="let ques of questions | async">
<div >
{{ ques.question }}
</div>
<div style="text-align:right;">
<button mat-button color="primary" (click)="showReply(ques.id)" >Show Reply</button>
</div>
<mat-card *ngIf="replyState && id== '{ques.id}'">
<div style="height:30px;">
<input type="text" >
<button mat-button (click)="sendReply(ques.id)">Send Reply</button>
</div>
<mat-card-content ngFor="let rep of replies">
reply
</mat-card-content>
</mat-card>
</mat-card>
在component.ts
中showReply(id){
console.log(id);
this.replyState=!this.replyState;
this.id = id;
this.frm.getReplies(id).subscribe(next =>{
next.replies
this.replies=next.replies
})
}