Ionic3 radio button ionSelect/ionChange not working when initial array list is updated/change


#1

this is my array:
people: any = [{
“name”: “Douglas”,
“value”: 1
},{
“name”: “Mcleod”,
“value”: 2
},{
“name”: “Day”,
“value”: 3
}];

this is ionic list:

<ion-item *ngFor=“let name of people; let i=index”>
<ion-label (ionSelect)=“setPerson($event)”>{{name.name}}
<ion-radio (ionSelect)=“setPerson($event)” value="{{name.value}}">

this the function called when radio button is selected:
setPerson(person){
alert(persion)
}

ionselect is triggered if radio button is selected. The problem is when I change the people list on button (click) = “refreshList()”
refreshList(){
people = [{
“name”: “Aguirre”,
“value”: 4
},{
“name”: “Cook”,
“value”: 5
},{
“name”: “Meyers”,
“value”: 6
}];
}

the ioni-list is updated with the people listing but the problem is the (ionSelect)=“setPerson($event)” is not triggered anymore on updated people list.

I am new with angular and ionic3. Any help with be greatly appriciated. Thank you!


#2

seems to be working fine?? https://stackblitz.com/edit/ionic-pxrpus


#3

Thank you @aaronksaunders! yes, you are right it’s working fine in your sample. I will look into my codes properly why the setPerson() triggered only once on initial load only but not when refresh. I really appriciate your help!