更新* ngFor中的列表而不回忆该对象

时间:2018-06-02 02:42:30

标签: angular typescript

#!/bin/bash sleep .5 while [1] do omxplayer -b -r -live http://192.168.1.16:3000/fileserver/channelA done &在按下标有 确认 的按钮后触发student_obj_answer_id

问题: *ngIf="is_answered == true"不会像*ngIf="student_obj_answer_id==answer.cmp_qst_ans_sngl_id"

那样在每个循环中进行比较

预期产出:

*ngFor可以比较*ngIf="student_obj_answer_id==answer.cmp_qst_ans_sngl_id"

中的每个循环

我目前的代码:

*ngFor

在控制器中: -

<div *ngIf="component.details.qst_main.question_type == QST_FORMAT.SINGLE_ANSWER">
    <div class="answers">
    <ng-container *ngFor="let answer of component.details.qst_main.answers">
        <div [ngClass]="{'selected':userAnswerObjectiveSelected==answer.cmp_qst_ans_sngl_id,'avoid-clicks':avoid_clicks}"
             (click)="getUserObjectiveAnswer(answer,answer.cmp_qst_ans_sngl_id)" class="answer-list">
            <div [innerHTML]="answer.answer_text"></div>
            <div class="answer-check-sign" *ngIf="is_answered == true">
                <div *ngIf="student_obj_answer_id==answer.cmp_qst_ans_sngl_id">
                    <div *ngIf="answer.is_correct_answer==1">
                        <img [src]="'assets/imgs/question/correct.svg'"/>
                    </div>
                    <div *ngIf="answer.is_correct_answer==0">
                        <img [src]="'assets/imgs/question/wrong.svg'"/>
                    </div>
                </div>
                <div *ngIf="student_obj_answer_id!=answer.cmp_qst_ans_sngl_id">
                    <div *ngIf="answer.is_correct_answer==1">
                        <img [src]="'assets/imgs/question/correct.svg'"/>
                    </div>
                </div>
            </div>
        </div>
    </ng-container>
    </div>
</div>

0 个答案:

没有答案