title: Remove whole table row angularjs button
body: <p>I have a table with some sample data.  I have a button that I want to use with in the table row that will remove the whole table row when clicked.  Problem is what I have coded up will remove the content from the table row and leave the button and table row.  Or it will remove the last table row not the row the button was clicked in.  </p>
  
  <p>Here is what I have :</p>
  
  <p>controller :</p>
  
  <pre><code>    $scope.removeRow = function (product) {
  
      var index = -1;
      var productArray = eval($scope.products);
  
      for (var i = 0; i &lt; productArray.legnth; i++) {
          if (productArray[i].productName == product.productName) {
              index = i;
  
          console.log(productArray[i].productName);
          }
      }
      if (index === -1) {
          alert("something broke");
      }
  
      $scope.products.splice(index, 1);
  }
  </code></pre>
  
  <p>html</p>
  
  <pre><code> &lt;table class="table table-bordered table-hover"&gt;
                      &lt;tr&gt;
                          &lt;!--&lt;th&gt;&lt;button class="btn btn-primary" type="button" data-ng-click="showImage = !showImage"&gt;{{showImage ? "Hide" : "Show"}} Image&lt;/button&gt;&lt;/th&gt;--&gt;
                          &lt;th&gt;Show or Hide &lt;/th&gt;
                          &lt;th&gt;Product&lt;/th&gt;
                          &lt;th&gt;Code&lt;/th&gt;
                          &lt;th&gt;Avaiable&lt;/th&gt;
                          &lt;th&gt;Price&lt;/th&gt;
                      &lt;/tr&gt;
                      &lt;tr data-ng-repeat="product in products"&gt;
                          &lt;td&gt;&lt;input type="button" class="btn btn-primary" value="Hide" data-ng-click="removeRow(product)"/&gt;&lt;/td&gt;
                          &lt;td&gt;{{product.productName}}&lt;/td&gt;
                          &lt;td&gt;{{product.productCode}}&lt;/td&gt;
                          &lt;td&gt;{{product.releaseDate}}&lt;/td&gt;
                          &lt;td&gt;{{product.price | currency}}&lt;/td&gt;
                      &lt;/tr&gt;
                  &lt;/table&gt;
  </code></pre>