So I have a radio-group ion-list element, thus far it works given the following:
<ion-list radio-group [(ngModel)]="selectedAddress">
<ion-item *ngFor="let address of userAddresses">
<ion-label>{{address.Street}}, {{address.Suburb}}, {{address.City}}</ion-label>
<ion-radio value="{{address.RefAddress}}"></ion-radio>
</ion-item>
</ion-list>
The data I used to populate this is a collection of Address objects implementing the following interface:
export interface Address {
RefAddress?:number,
Street:string,
Street2?:string,
Suburb:string,
City:string,
Province:string,
Country:string
}
This works without a hitch, I can select items and my ngModel is populated with with whichever address I chose. Now however, I cannot set the selected item in code when the user opens the page again to edit a previous selection and the list is reloaded, i.e I populated the selectedAddress with an address item when the page is loaded:
if (this.navParams.get("Address")) {
this.selectedAddress = this.navParams.get("Address");
}
I made sure to only call the above function once all the items are loaded to the list first and with debugging I can confitm the selectedAddress prop is being set. What am I missing?