title: creating property dynamically in ng-model
body: <pre><code>  &lt;div class="form-group" data-ng-repeat="choice in choices"&gt;
      &lt;input type="text" ng-model="user.subjectname[$index]" 
     name="subject" ng-required="true" placeholder="Enter a subject name"&gt;
     &lt;/div&gt; 
  </code></pre>
  
  <p>As I am creating this input field dynamically using ng-repeat, if I used <code>ng-model=user.subjectname</code>, the input text for some reason was same in all the fields, I searched over the internet and found <code>ng-model="user.subjectname[$index]"</code>   being used and it worked.</p>
  
  <p>However, i am not able to understand </p>
  
  <ol>
  <li>what it exactly means.  ? </li>
  </ol>
  
  <p>2.If it's array or an object. ?</p>
  
  <ol start="3">
  <li><p>It shows up as object in console. ?</p></li>
  <li><p>If it's object, why does it have an index?</p></li>
  </ol>
  
  <p>Also, as we can iterate over object vals using this format:</p>
  
  <pre><code>ng-repeat="(key,val) in user.subjectname"{{val}}
  </code></pre>
  
  <p>Why did it not work?</p>
  
  <pre><code>neither did ng-repeat="subject in user.subjectname"{{subject}}
  </code></pre>
  
  <p>Can  I please get directions as I am very confused about it at the moment.</p>