title: Can I push then display data from array in Angular
body: <p>I want to add contact and contact details by sending them to MVC controller like an object and a list. Firstly i made an input boxes in HTML with scopes and an empty array in controller then I ng-repeat on it to display the inserted data. but unfortunately the console.log says undefined objects.</p>
  
  <p>The controller </p>
  
  <pre><code> .controller("forwardersCon", function ($scope, forwardersSrv) {
  
      $scope.contactsdetails = [];
  
      $scope.add = function ()
      {
          $scope.contactsdetails.push({ Contactname: $scope.contname, Contacttype: $scope.conttype, phones: $scope.contphn, fax: $scope.contfax })
          console.log($scope.contactsdetails);
      }
  
  })
  </code></pre>
  
  <p>The HTML </p>
  
  <pre><code>&lt;body ng-app="forwarders" ng-controller="forwardersCon"&gt;
  &lt;div class="form-horizontal"&gt;
      Company name&lt;input type="text" id="contname" class="form-control" ng-model="contname" /&gt;
      Company type&lt;select class="form-control" ng-model="conttype"&gt;
          &lt;option&gt;Shipping Line&lt;/option&gt;
          &lt;option&gt;Logistics&lt;/option&gt;
      &lt;/select&gt;
      Company Phone&lt;input type="text" id="contphn" class="form-control" ng-model="contphn"/&gt;
      Company Email&lt;input type="text" id="contfax" class="form-control" ng-model="contfax"/&gt;
  &lt;/div&gt;
  &lt;br /&gt;
  &lt;table class="table table-responsive" id="salesdetails1"&gt;
      &lt;tr&gt;
          &lt;th&gt;Sales Name&lt;/th&gt;
          &lt;th&gt;Sales Phone&lt;/th&gt;
          &lt;th&gt;Sales Email&lt;/th&gt;
          &lt;th&gt;Sales Fax&lt;/th&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;input type="text" class="form-control" /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type="text" class="form-control" /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type="text" class="form-control" /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type="text" class="form-control" /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;button type="button" class="btn btn-success" id="add" ng-click="add()"&gt;Add&lt;/button&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  
  &lt;h4&gt;Contact Details&lt;/h4&gt;
  
  &lt;table class="table table-responsive" id="salesdetails2"&gt;
      &lt;tr ng-repeat="c in contactsdetails"&gt;
          &lt;td&gt;{{c.Contactname}}&lt;/td&gt;
          &lt;td&gt;{{c.Contacttype}}&lt;/td&gt;
          &lt;td&gt;{{c.phones}}&lt;/td&gt;
          &lt;td&gt;{{c.fax}}&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  
  
  &lt;script src="~/Scripts/angular.js"&gt;&lt;/script&gt;
  &lt;script src="~/AnglForwarder.js"&gt;&lt;/script&gt;
  &lt;script src="~/Scripts/jquery-3.1.1.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p></p>
  
  <p>any help, how to push the inserted data from input box to array and then display it on html table. Thanks lot</p>