@lilaless wrote:
I’m trying to implement an App with some Questions. The User have to select an option. When the user have to navigate a page back so the previous radio buttons have to stay “checked”. But in HTML it’s does’nt display “checked”. But its checked!
Please let me know, what I make wrong.
This is my HTML
<ion-item *ngFor="let op of question.body; let i = index"> <ion-label> <div>{{op}}</div> </ion-label> <ion-radio [checked]="antworten[currentQuestion]===op? true: false"(ionSelect)="answerRadioButton(question.id,op)></ion-radio> </ion-item> </ion-radio-group> </ion-item>
This is my TS
showQuestion(index: number) { this.select = this.answers[index]; if (!this.select) { this.questionIsAnswered = false; } else { this.questionIsAnswered = true; } this.question = this.question[index]; } answerRadioButton(question, answer) { this.answers[question.id] = answer; this.questionIsAnswered = true; }
**THIS IS NOT WORKING **
[checked]="antworten[currentQuestion]===op? true: false"
Posts: 1
Participants: 1