title: AngularJS - How do I push key value pairs into an array?
body: <p>I'm attempting to push a new object with some key:value pairs into an array using AngularJS, and seem to be running into some trouble.</p>
  
  <p>Here's the html: </p>
  
  <pre><code>&lt;div class="small-12  medium-6 large-6 columns"&gt;
  
    &lt;div id="addSubTarget"&gt;   
      &lt;p&gt;Add Targets&lt;/p&gt;
      &lt;input type="text" ng-model="sublevel.tagName"&gt;
      &lt;button type="button" class="resultsButton" ng-click="addTag()"&gt;Submit&lt;/button&gt;
    &lt;/div&gt;
  
    &lt;div id="addSubTargetBox"&gt;
      &lt;p&gt;Targets Added&lt;/p&gt;
      &lt;div id="targetAddedBox"&gt;
        &lt;div class="targetAddedInBox" ng-repeat="tag in tagsFeed track by $index"&gt;
          {{tag}}
          &lt;i class="fa fa-trash-o" title="Delete this tag" ng-click="deleteTag($index)"&gt;&lt;/i&gt;
        &lt;/div&gt;
      &lt;/div&gt;                      
    &lt;/div&gt;
  
  &lt;/div&gt;
  
  &lt;div class="small-12  medium-6 large-6 columns"&gt;    
  
    &lt;div class="sublevelAddTextArea"&gt;
      &lt;p&gt;Instructions&lt;/p&gt;
      &lt;textarea rows="4" ng-model="sublevel.instructions"&gt;&lt;/textarea&gt;
    &lt;/div&gt;
  
    &lt;div class="sublevelAddTextArea"&gt;
      &lt;p&gt;Response&lt;/p&gt;
      &lt;textarea rows="4" ng-model="sublevel.response"&gt;&lt;/textarea&gt;
    &lt;/div&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>And the button here:</p>
  
  <pre><code>&lt;button type="button" class="resultsButton" ng-click="submitNewSub()"&gt;Submit&lt;/button&gt;
  </code></pre>
  
  <p>Here's the function in the controller:</p>
  
  <pre><code>$scope.submitNewSub = function(){
  
    var arrayForUse = [];
  
    arrayForUse.push({
      tag: $scope.tagsFeed,
      instructions: $scope.sublevel.instructions,
      response:$scope.sublevel.response
    });
  
    console.log(arrayForUse);
  
    $scope.listTable.push(arrayForUse);
  
  }
  </code></pre>
  
  <p>I am using a hard coded array for testing it looks like this:</p>
  
  <pre><code>$scope.listTable = [{
    tag: "tags 1",
    instructions: "instructions 1",
    response: "response 1"
  },
  {
    tag: "tags 2",
    instructions: "instructions 2",
    response: "response 2"
  }];
  </code></pre>
  
  <p>I basically need those inputs to push onto that array in that structure so angular two-way data binding will update my front end, however something seems to not be working for me.</p>