title: Dynamically creating radio buttons and selected appropriate button Angularjs
body: <p>I have a questionnaire form that loops over questions and the answers in the questions and then creates radio buttons with the answers.  The answer object will have a property of answered which will either be true or false depending on whether or not that answer had been previously selected for the item.  If answer.answered = true, that radio button should be checked(only one will have been answered).  The problem is is that I can not get the appropriate radio button to be checked based on answer.answered.  I have tried ng-value="answer.answered", setting the model on init.  Abbreviated code below.</p>
  
  <pre><code> &lt;md-card data-ng-repeat="question in gradeCtrl.questions | limitTo: 1  track by $index" class="questions main-questions" 
  data-ng-if="!gradeCtrl.subQuestions &amp;&amp; gradeCtrl.needsRepairs === false"&gt;
  &lt;ul data-ng-repeat="answer in question.answers track by $index" class="questionnaire" layout-wrap layout="column" layout-align="center center"&gt;
  &lt;li&gt;
  &lt;input type="radio" name="{{question.id}}" data-ng-attr-id="answer.id" data-ng-value="gradeCtrl.isAnswered(answer);"
   data-ng-init="gradeCtrl.radioButton[answer.id]=gradeCtrl.isAnswered(answer);"
   data-ng-model="gradeCtrl.radioButton[answer.id]"&gt;
  &lt;/li&gt;
  &lt;/md-card&gt;
  </code></pre>