title: AngularJS populate textbox from array
body: <p>I am facing a problem with AngularJS. I have made an application where a user can 
  select a value from a dropdown list. If the user presses the "add" button, then an array is created that holds all his selections. I want to populate a textbox with all these selections. I have tried ng-repeat but it creates multiple textbox with each array value. This is what I've made so far:</p>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>$scope.multiCompare= [];
  
  // Create the function to push the data into the "multiCompare" array
  $scope.newCompare = function () {
  
      $scope.multiCompare.push($scope.compareDate);
  
  
      $scope.multiComparedate = '';
  
  
  
  };
  </code></pre>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;div class="form-group"&gt;
                  &lt;label for="installation_year" class="col-sm-2 control-label"&gt;Period&lt;/label&gt;
                  &lt;div class="col-sm-4"&gt;
                      &lt;select class="form-control" ng-model="compareDate" ng-options="res for res in compareDates " ng-disabled="disableFormInput()" &gt;&lt;/select&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;div class="col-sm-offset-2 col-sm-10"&gt;
                      &lt;button type="submit" class="btn btn-default" ng-click="newCompare()"&gt;Add&lt;/button&gt;
                       &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;label for="from_date" class="col-sm-2 control-label"&gt;Compare&lt;/label&gt;
                  &lt;div class="col-sm-4"&gt;
                      &lt;div ng-repeat="num in multiCompare" track by $index&gt;
                          &lt;input class="form-control" type="text" ng-model="$parent.multiCompare[$index]"&gt;
                          &lt;div&gt; {{num}}&lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>The first image shows the result I'm getting when adding 2013 and 2014 and the second shows what I would like it to return.</p>
  
  <p><img src="https://i.stack.imgur.com/L5mSa.png" alt="This is the result I&#39;m getting"></p>
  
  <p><img src="https://i.stack.imgur.com/KovaI.png" alt="This is what I want it to show"></p>
  
  <p>Can someone help me through this?
  Thanks in advance..</p>