I have a quiz app where when I try to change the color of the selected button on the click, the color of all the button changes. I am trying to access the index of the button but i am sure how to implement it.
can someone please help
<div class="options" *ngFor="let option of q.options; let i = index;">
<button (click)="selectAnswer(option, i)" block ion-button [color]="ionicColor">{{ option.name }}</button>
</div>
My function looks like this
selectAnswer (selectedOption, index) {
this.selectedAnswer = selectedOption;
console.log(this.allQuestions);
this.ionicColor="dark";
}