title: How can i set model name dynamically in angular?
body: <p>How to set the model name dynamically in ng-repeat loop</p>
  
  <pre><code>    &lt;div ng-controller="parentController"&gt;
        &lt;div ng-ccontroller="childController"&gt;
  
           &lt;div data-ng-repeat="category in categories"&gt;
             &lt;label &gt;{{category.name}}&lt;/label&gt;
  
             &lt;div class="radio"&gt;
               &lt;label&gt;&lt;input type="radio" name=? value="1" ng-model=?&gt; value 1&lt;/label&gt;
               &lt;label&gt;&lt;input type="radio" name=? value="2" ng-model="?"&gt; value 1&lt;/label&gt;
            &lt;/div&gt;
  
          &lt;/div&gt;
  
       &lt;/div&gt;
     &lt;/div&gt;
  </code></pre>
  
  <p>Here in above I have to set name and ng-model values dynamically Like <strong>$parent.cat0,$parent.cat1,$parent.cat2</strong> of parent controller whenever loop through happens.</p>
  
  <p>I tried the following:</p>
  
  <pre><code>ng-model = '$parent.cat'+{{$index}}
           or
  ng-model = "'$parent.cat1'+{{$index}}"
          or
  ng-model = "$parent.cat"+{{$index}}
  </code></pre>
  
  <p>I tried the above things nothing worked out. Is there any other method to set the model name dynamically in angular js.</p>
  
  <p>I am expecting somethong like this (given in normal html)</p>
  
  <pre><code>&lt;label&gt;category1&lt;/label&gt;
        &lt;input type="radio" name ="cat1" value=0&gt;value0&lt;/input&gt;
        &lt;input type="radio" name ="cat1" value=1&gt;value1&lt;/input&gt;
  &lt;label&gt;category2&lt;/label&gt;
        &lt;input type="radio" name ="cat2" value=0&gt;value0&lt;/input&gt;
        &lt;input type="radio" name ="cat2" value=1&gt;value1&lt;/input&gt;
  </code></pre>