title: Populate inputs by number angularjs
body: <p>I am trying to populate input by typing the number in input[number].</p>
  
  <p>Why this doesn't work</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>// Code goes here
  
  var app = angular.module('app', []);
  
  app.controller('MainCtrl', function($scope) {
      $scope.lengInput = {
          count: 0,
          values: [],
          fill: function(limit) {
              var sequence = [];
              for (var i = 0; i &lt; limit; i++) {
                  sequence.push(i);
              }
              return sequence;
          }
      };
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html ng-app="app"&gt;
  
    &lt;head&gt;
      &lt;meta charset="utf-8" /&gt;
      &lt;title&gt;AngularJS Plunker&lt;/title&gt;
      
      &lt;link rel="stylesheet" href="style.css" /&gt;
      &lt;script data-require="angular.js@1.5.x" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.11/angular.js" data-semver="1.5.11"&gt;&lt;/script&gt;
      &lt;script src="script.js"&gt;&lt;/script&gt;
    &lt;/head&gt;
  
    &lt;body ng-controller="MainCtrl"&gt;
      &lt;p&gt;Hello {{name}}!&lt;/p&gt;
      &lt;input ng-model="lengInput.count" type="number" min="1" max="20"&gt;
      &lt;ul&gt;
          &lt;li ng-repeat="i in lengInput.fillSequence(lengInput.count)"&gt;
              &lt;input ng-model="lengInput.values[i]" /&gt;
          &lt;/li&gt;
      &lt;/ul&gt;
    &lt;/body&gt;
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>since this is working </p>
  
  <p><a href="https://plnkr.co/edit/qejQiWCulU67M5rWI7Vg?p=preview" rel="nofollow noreferrer"><p><kbd><b>JSFiddle Demo</b></kbd></p></a></p>
  
  <p>Please find my mistake.</p>