How can I change the button background color on click in ionic 3 app

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";
  }

Try to use ngClass or ngStyle. Please look them up. They allow you to change CSS3 style on click.