title: AngularJs: Binding ng-model to a list of radio buttons
body: <p>Im trying to bind the selected value in a list of radio buttons to an <code>ng-model</code></p>
  
  <p>I have:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  
  &lt;html ng-app="testApp"&gt;
      &lt;head&gt;
          &lt;script src="./bower_components/angular/angular.min.js"&gt;&lt;/script&gt;
          &lt;script src="test.js"&gt;&lt;/script&gt;
      &lt;/head&gt;
      &lt;body ng-controller="testController"&gt;
          &lt;form&gt;
              &lt;div ng-repeat="option in occurrenceOptions"&gt;
                  &lt;input type="radio" name="occurrence" ng-value="option" ng-model="selectedOccurrence" /&gt;&lt;label&gt;{{ option }}&lt;/label&gt;
              &lt;/div&gt;
          &lt;/form&gt;
          &lt;div&gt;The selected value is : {{ selectedOccurrence }}&lt;/div&gt;
  
          &lt;!-- This works --&gt;
          &lt;input type="radio" ng-model="selected2" ng-value="'1'"&gt; 1
          &lt;input type="radio" ng-model="selected2" ng-value="'2'"&gt; 2
          &lt;input type="radio" ng-model="selected2" ng-value="'3'"&gt; 3
  
          &lt;div&gt;This selected value is : {{ selected2 }} &lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>For my controller:</p>
  
  <pre><code>(function () {
  
      var app = angular.module('testApp', []);
  
      app.controller('testController', function($scope) {
          $scope.occurrenceOptions = [];
  
          $scope.occurrenceOptions.push('previous');
          $scope.occurrenceOptions.push('current');
          $scope.occurrenceOptions.push('next');
  
          $scope.selected2;
      });
  }());
  </code></pre>
  
  <p>In the first section, I tried to ng-repeat all the <code>occurrenceOptions</code> and bind them all to the same model. However, each time I select something the <code>selectedOccurrence</code> value does not change.</p>
  
  <p>See plunkr: <a href="https://plnkr.co/edit/k1pMgkLdrMUG1blktQx1?p=preview" rel="noreferrer">https://plnkr.co/edit/k1pMgkLdrMUG1blktQx1?p=preview</a></p>
  
  <p>without the <code>ng-repeat</code> and just typing out all the radio buttons, I am able to get this to work. Why is the <code>ng-repeat</code> version not working?</p>