I need help with pre-selecting the first radio button from a generated list of radio buttons that can be changed if user selects a different radio btn...
My attempt is returning me this error: TypeError: Cannot read properties of undefined (reading '0')
delivery-dates.model.ts
export interface DeliveryDates {
  color: string;
  date: string;
  date_name: string;
}
cart.page.ts code:
export class CartPage implements OnInit, OnDestroy {
  dates: DeliveryDates[];
  selectedValue: any;
  private datesSubscription: Subscription;
  constructor() {
  }
  ngOnInit() {
    this.getDeliveryDates();
    this.selectedValue = this.dates[0].date;
  }
  getDeliveryDates() {
    this.datesSubscription =
      this.cartService.getDeliveryDates().subscribe(
        data => {
          this.dates = data;
        },
        error => {
          console.log('Error', error);
        });
  }
}
cart.page.html
<ion-list class="dates-list">
  <ion-radio-group value="{{dates[0]}}"  [(ngModel)]="selectedValue">
    <ion-item *ngFor="let datum of dates;let i = index" (click)="modal.dismiss()">
      <ion-icon name="today-outline"></ion-icon>
      <ion-label class="{{datum.color}}">{{datum.date_name}} {{ datum.date }}</ion-label>
      <ion-radio slot="end" value="{{ datum.date }}"></ion-radio>
    </ion-item>
  </ion-radio-group>
</ion-list>
 
    