title: Set checked radio button in a radio group programmatically in Ionic 5 with Angular 9
body: <p>I'm doing an application in Ionic 5 and Angular 9.</p>
  <p>I have a radio-group with options that I fetch with an HTTP request, and I want to set one of them as selected programatically.</p>
  <p>Component:</p>
  <pre><code>  options: {id: string, description: string}[] = [];
    optionSelected = null;
  
    constructor(
      private service: MyService,
    ) {
    }
  
    ngOnInit() {
      this.service.getOptions()
        .pipe(first())
        .subscribe(res =&gt; {
          this.options = res;
  
          // Setting the option selected by default.
          this.optionSelected = {id:&quot;001&quot;, description:'This is selected by default'};
        });
    }
  
    trackById(index: number, option: any): string {
      return option.id;
    }
  </code></pre>
  <p>Template:</p>
  <pre><code>&lt;ion-list&gt;
  
      &lt;ion-radio-group (ionChange)=&quot;optionSelected = $event.target.value&quot; [(ngModel)]=&quot;optionSelected&quot;&gt;
  
        &lt;ion-item *ngFor=&quot;let a of options; trackBy: trackById&quot;&gt;
          &lt;ion-radio slot=&quot;start&quot; [value]=&quot;a&quot;&gt;&lt;/ion-radio&gt;
          &lt;ion-label class=&quot;ion-text-wrap&quot;&gt;&lt;h3&gt;{{a.description}}&lt;/h3&gt;&lt;/ion-label&gt;
        &lt;/ion-item&gt;
  
      &lt;/ion-radio-group&gt;
  
    &lt;/ion-list&gt;
  </code></pre>
  <p>When I fetched the data, I assign the object that I want to be selected, but, it's not selected in the radio-group.</p>
  <p>My goal is to check a radio button in the radio-group programmatically when I fetch the data.</p>