title: how to write a [(ngModel)] = "" dynamically on ionic?
body: <p>I'm trying to create dynamic fields in ionic for my poll app</p>
  
  <p>First . I have 2 arrays</p>
  
  <p><a href="https://i.stack.imgur.com/HlnHQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HlnHQ.png" alt="enter image description here"></a></p>
  
  <p>then I'm trying to create the fields with a swich case</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;ion-list *ngFor="let preguntas of LocalPreguntas"&gt;
        &lt;ion-card &gt;
          &lt;ion-card-header color="primary"&gt;
            {{ preguntas.pregunta}}
          &lt;/ion-card-header&gt;
          &lt;ion-card-content [ngSwitch]="preguntas.tipo"&gt;
      
                    &lt;!-- Respuesta Si o no--&gt;
                    &lt;div  *ngSwitchCase="4" style="display:block" &gt;   
                        &lt;ion-list radio-group  name="{{preguntas.id}}" [(ngModel)]="Form.radio_vf" required&gt;
                            &lt;ion-item &gt;
                                &lt;ion-label  color="dark"&gt;Si&lt;/ion-label&gt;
                                &lt;ion-radio value="Si"&gt;&lt;/ion-radio&gt;
                              &lt;/ion-item&gt;
                            
                              &lt;ion-item  &gt;
                                &lt;ion-label  color="dark"&gt;No&lt;/ion-label&gt;
                                &lt;ion-radio value="No"&gt;&lt;/ion-radio&gt;
                              &lt;/ion-item&gt;
  
                         &lt;/ion-list&gt;
                    &lt;/div&gt;
          &lt;/ion-card-content&gt;  
        &lt;/ion-card&gt;
     &lt;/ion-list&gt;</code></pre>
  </div>
  </div>
  
  its all right </p>
  
  <p><a href="https://i.stack.imgur.com/pBODC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pBODC.png" alt="enter image description here"></a></p>
  
  <p>but logically this is wrong <code>[(ngModel)] = "Form.txt_cantidad"</code> because the app can repeat the question types</p>
  
  <p>to fix that. I want to put the question id in the <code>[(ngModel)]</code></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code> &lt;div  *ngSwitchCase="4" style="display:block" &gt;   
   &lt;ion-list radio-group  name="{{preguntas.id}}" [(ngModel)]="{{preguntas.id}}" required&gt;
          &lt;ion-item &gt;
                &lt;ion-label  color="dark"&gt;Si&lt;/ion-label&gt;
                &lt;ion-radio value="Si"&gt;&lt;/ion-radio&gt;
          &lt;/ion-item&gt;
                            
          &lt;ion-item  &gt;
                &lt;ion-label  color="dark"&gt;No&lt;/ion-label&gt;
                &lt;ion-radio value="No"&gt;&lt;/ion-radio&gt;
          &lt;/ion-item&gt;
  
       &lt;/ion-list&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><a href="https://i.stack.imgur.com/kYP1v.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kYP1v.png" alt="enter image description here"></a></p>