title: bootstrap popover conditional expression angularJS
body: <p>I have some cells, with an ng-click, that filters the data I get from the API.</p>
  
  <p>So I get from the API a big array, and depeding on what cell I click, that array gets filtered, and its filtered content shown in the popover.</p>
  
  <p>All working great, but I have an issue, when after the filtering the array is empty, because none of the data meets the criteria, I get an empty popover, and what I want, is that if the array is empty, the popover doesnt show up at all!</p>
  
  <p>I thought I found a solution, but it's not optimal, I used:</p>
  
  <pre><code>popover-enable="vm.isThereData"
  </code></pre>
  
  <p>and <code>isThereData</code> is a <code>Bool</code> that returns <code>false</code> if the filtered array returns empty: </p>
  
  <pre><code>if(this.apiData.activities.length &lt; 1){
                  return this.isThereData = false;
              } else {
                  return this.isThereData = true;
              }
  </code></pre>
  
  <p>I put this code in my function that filters the array that and that gets called with the ng-click on the cell in the view!</p>
  
  <p>The problem is, as the array with the filtered data gets created on the fly when I click on the cell, the popover will show up on that first click, and only then, my var <code>isThereData</code> will get <code>false</code> if there was no data, and from there on it will disable the popover to show!</p>
  
  <p>I understand why, before the first click the filtered array has still not been created, so the popover will show, but can't think of a solution.</p>
  
  <p>How can I use <code>popover-enable</code> to disable it from showing, if to decide if it needs to be shown or not, I first need to click on a cell to get the filtered data?</p>
  
  <p>I would need somehow that as soon as I click and the new array with the filtered data gets created, THEN it checks for the <code>popover-enable</code> and activates or not the popover!</p>
  
  <p>edit: code for display popover on click on the cell:</p>
  
  <pre><code>    ng-repeat="month in [].constructor(12) track by $index" 
  ng-click="vm.setDataForActivities(t.activity.id, $index+1)" 
  popover-class="popoverCustomSize" popover-append-to-body="true" 
  popover-placement="bottom-left"
  popover-trigger="'outsideClick'" 
  popover-enable="vm.isThereData" 
  uib-popover-template="'Views/xxx/yyy/popoverTemplate.htm'"&gt;
  </code></pre>
  
  <p>and the function to filter data on the ng-click just takes as args the array given by the API with all the data, and filters it by date (each cell is a different date, so when you click on it, the ng-click and this function will filter the data so only the data within the date of the cell will be displayed)</p>