I am using ionic with angular, the html (simple version)
<ion-content *ngIf=“show” >
< ion-radio-group [value]=“option” (ionChange)=“selectOption($event)” >
<ion-button (click)=“doShow()”>
the ts (simple version)
let show = false;
let apple = ‘a’ ;
doShow(){
this.show = !this.show;
if(this.apple == ‘b’ ){
this.apple = ‘a’ ;
}
}
selectOption($event){ this.value = $event.target.value }
What I am trying to do is basically, we will have a button to control existence of the ion-content, that wrap the ion-radio-group inside.
The ion-radio-group is linked to ts file apple value. When switching on and off the ion-content. We will do some modification on the default value. If it is ever ‘b’, we set it to ‘a’.
Yes, the ui does reflects the changes from ‘b’ to ‘a’. If it is ever a ‘b’ to ‘a’. The ion-radio is lighten up.
The problem appears when we have never change to value of ‘b’ in the first place. And the value remains ‘a’ . When the ion-content is switching on and off, the value is accurately stay the same of ‘a’, but the UI no longer reflect the selected value once the ion-content is re-open for once. The ion-radio is never lighten up if it stays as ‘a’.
I have also try the work around of of setting the value ‘a’ even it is already ‘a’. still not lighten up the ion-radio.
1 post - 1 participant