title: Check if the ng-click button was clicked already
body: <p>I am toggling my <code>div</code> on <code>ng-click</code> using <code>isVisible</code>. The problem I am having is that every time I click the button, it runs <code>$scope.Objectlist.push(data);</code>. I want to only push it on the first click but at the same time I want it to push if its fetching a different object. I have a button beside every row and each row has a different id which is getting passed as the parameter for the button function.</p>
  
  <p><strong>HTML:</strong></p>
  
  <pre><code>&lt;tr ng-repeat="object in objectlist"&gt;
      &lt;td&gt;{{object.id}}&lt;/td&gt;
      &lt;td&gt;&lt;button ng-click="pushData(object.id)"&gt;View&lt;/button&gt;&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p><strong>JS:</strong></p>
  
  <pre><code>$scope.objectlist = [];
  $scope.isVisible = false;
  $scope.pushData= function(id) {
      $http.get("some variables being passed on here").success(function(data, status, headers, config){
              $scope.objectlist.push(data);
      }).error(function(data, status, headers, config){
          alert("Error");
      });
      $scope.isVisible = ! $scope.isVisible;
  };
  </code></pre>
  
  <p>I have multiple different objects some are empty and some are not so this function cannot just check for the length of the list</p>