title: Dynamically adding/creating object to array from angular view to controller using two way binding
body: <p>I have one controller, controller's template/view as below,</p>
  
  <p><strong>myController</strong></p>
  
  <pre><code>angular.module('myApp', []).
  controller('myController', ['$scope', function($scope) {
          $scope.myObject = {};
  }]);
  </code></pre>
  
  <p><strong>myView</strong></p>
  
  <pre><code>&lt;div class="container" ng-app="myApp"&gt;
      &lt;form name="myForm" novalidate ng-controller="myController"&gt;
          &lt;div class="form-group"&gt;
              &lt;label for="firstname" class="control-label col-xs-2"&gt;Name&lt;/label&gt;
              &lt;div class="col-xs-10"&gt;
                  &lt;input type="text" ng-model="myObject.firstname" id="firstname"&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="form-group"&gt;
              &lt;label for="lastname" class="control-label col-xs-2"&gt;LastName&lt;/label&gt;
              &lt;div class="col-xs-10"&gt;
                  &lt;input type="text" ng-model="myObject.lastname" id="lastname"&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>here whenever user enters any data it gets reflected to <code>myObject</code> with <code>firstname</code> and <code>lastname</code> as dynamic properties for <code>myObject</code>.
  Now my new requirement is to add multiple dynamic views for <code>firstname</code> and <code>lastname</code> in the same view(For that I will be creating a directive and appending dynamically), and now I want <code>myObject</code> to be an <code>array of objects</code> like</p>
  
  <pre><code>myObjectArray = [{firsname: "abc", lastname: "xyz"},{firsname: "abc", lastname: "xyz"},{firsname: "abc", lastname: "xyz"},{firsname: "abc", lastname: "xyz"}]
  </code></pre>
  
  <p>and here each object should be populated through dynamically added views by user input using angular two way binding. But I am not sure how can I achieve this with angular, how to add object to array whenever there is a new directive template added to view dynamically.</p>