Calling Popover trough boolean or programmatic

38 Views Asked by At

I have a popover which I am calling when an event is fire. But I need that popover to be global

here the popover

<div class="popover" tabindex="-1">
  <h5 ng-bind-html="title" ng-show="title"></h5>
   ...
    <button type="button" ng-click="refreshAfterBet(); $hide()">
     OK
    </button>
  </div>
</div>

I am calling it like this

  <button ng-click="placeStraightBet(slip)"
          title="Bet Confirmation"
          data-placement="bottom" data-template="views/betConfirmModal.html"
          data-auto-close="1"
          bs-popover="" ng-disabled="slip.active != '1'"> Place Bet
  </button>

and here the Angular part

$scope.refreshAfterBet = function() {
  BetSlipFactory.retrieveBetSlip();
};

$scope.placeStraightBet = function(slip) {
  var winValue = parseFloat(slip.risk, 10),
    riskValue = parseFloat(slip.win, 10),
    riskWin;
  if (winValue && riskValue && riskValue > 4) {
    BetSlipFactory.placeQuickBet({
      wagerType: 1
    }).then(function(betId) {

      // HERE I NEED TO CALL THE POPOVER 

       $scope.betId = betId;
    }, function(err) {
      $scope.betPlaceErr = err.message;
      console.log('Whoops, your bet was not placed', err.message);
    });
  }
};

OK, what I need:

1 - eliminate the function refreshAfterBet

the reason why I need to remove it is because that function should be within the promise where I wrote // HERE I NEED TO CALL THE POPOVER like this:

    ...
    }).then(function(betId) {

      // HERE I NEED TO CALL THE POPOVER 
      BetSlipFactory.retrieveBetSlip().then(function(){
        $scope.betId = betId;
      });
    } ...

If I put it there as you see above, the popover just disappear so the user can not see it. I attached the function refreshAfterBet to the button in the popover, but I am wrong, that function should be call when you call placeStraightBet.

here the DOCS for the popover I am using

So how should I call this popover ?

0

There are 0 best solutions below