How to change background button in ionic
ion-button in ionic when change background click, but default color change but you want to color of me, then shouldent change color in html or css of ionic.After i am doing a example ionic change background button you can do the following, to change its color.
Step 1. in file HTML
<ion-item class="functionClick" lines="none" >
<ion-button (click) ="pre()" *ngIf="checkPre">
<ion-img src ="../assets/icon/back.png" ></ion-img>
</ion-button>
<ion-button (click) ="next()" [color]="ionicColor">
<ion-img src ="../assets/icon/next.png" ></ion-img>
</ion-button>
</ion-item>
Step 2. in file ts
next(){
this.ionicColor = "red";
this.mPosition += 1;
if(this.mPosition > 0){
this.checkPre = true;
}else if(this.mPosition >=200){
alert("ban da qua cap 1");
}
localStorage.setItem("position",""+this.mPosition);
this.giaotiep = this.mData[this.mPosition];
}
No comments:
Post a Comment