title: Creating a radio group into json object with Angular
body: <p>I need a dynamic number of radio buttons based on radio name to create an object
  for example, I'm expecting an output of something like this</p>
  
  <p><strong>Expected Output</strong></p>
  
  <pre><code>[
   {Q1: '1'},
   {Q2: '3'} 
  ];
  </code></pre>
  
  <p>I tried by using [(ngModel)] </p>
  
  <p>But, when I click any radio, always the last one gets selected and the value is never assigned to ngModel.</p>
  
  <p>If I remove ngModel, the radios work fine, but, value is not set and only value can be selected at time. What can be done here?</p>
  
  <p><strong>app.component.html</strong></p>
  
  <pre><code>&lt;div *ngFor="let question of questions"&gt;
  &lt;ul&gt;
      &lt;li&gt;
        &lt;span&gt;{{question.id}}.{{question.name}}&lt;/span&gt;
        &lt;div *ngFor="let radio of radioGroup"&gt;
           &lt;input id="{{question.radioName}}" 
                  class="radio-button" 
                  [value]='radio.id' 
                  type="radio" 
                  name="radio"/&gt;
            &lt;div class="radio-tile"&gt;
               &lt;label for="{{question.radioName}}" 
                      class="radio-tile-label"&gt;
                        {{radio.name}}
               &lt;/label&gt;
             &lt;/div&gt;
           &lt;/div&gt;
          &lt;/li&gt;
        &lt;/ul&gt;
     &lt;/div&gt;
  </code></pre>
  
  <p><strong>app.component.ts</strong></p>
  
  <pre><code>export class AppComponent {
  
   questions;
   radioGroup;
  
   ngOnInit() {
    this.questions =[
     {
      id: '1', 
      name: 'What is your name?', 
      radioName: 'Q1',
      modelName: 'question1'
    },
    { 
      id: '2', 
      name: 'What is your role in your organization?',  
      radioName: 'Q2',
      modelName: 'question2' 
    }
   ];
  
  
   this.radioGroup = [
     {id: '1', name: 'Strongly Disagree'},
     {id: '2', name: 'Disagree'},
     {id: '3', name: 'Neutral'},
     {id: '4', name: 'Agree'},
     {id: '5', name: 'Strongly Agree'},
    ];
   }
  }
  </code></pre>