title: Binding using ng-model inside ng-repeat in angularjs
body: <p>I'm trying to bind a model 'User' to a list of input fields. I do not know the fields beforehand, so i've to write a generic code to setup the form based on the fields. </p>
  
  <pre><code>&lt;script&gt;
      function MyController($scope){
          $scope.fields  = ['name','password','dob'];
          $scope.user1 = {name:"Shahal",password:"secret"}
      };
  &lt;/script&gt;
  &lt;div ng-app ng-controller="MyController"&gt;
      &lt;ul&gt;
          &lt;li ng-repeat="field in fields"&gt;
              &lt;label&gt;{{field}}&lt;/label&gt;&lt;input type="text" ng-model="user1.{{field}}"&gt;
          &lt;/li&gt;
      &lt;/ul&gt;
      &lt;pre&gt;{{fields}}&lt;/pre&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I'm trying to loop through the fields and show a  input field for each fields (available in scope). But the binding is not proper as i'm trying to evaluate an expression inside ng-model.</p>
  
  <p>Basically i'm trying to show 3 input fields (name,password,dob) with the object user1 attached to the corresponding field.</p>
  
  <p>Here's the <a href="http://jsfiddle.net/CYPJ3/" rel="nofollow">fiddle</a></p>
  
  <p>Any help?</p>