通过布尔或程序化

时间:2015-06-24 18:27:41

标签: javascript angularjs angular-strap

我有一个popover,当事件发生时我正在打电话。但我需要那个popover是全球性的

这里是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>

我这样称呼它

  <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>

这里是Angular部分

$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);
    });
  }
};

好的,我需要的是:

1 - 删除函数refreshAfterBet

我需要删除它的原因是因为该函数应该在我写// HERE I NEED TO CALL THE POPOVER的承诺范围内:

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

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

如果我把它放在上面,那么popover就会消失,所以用户看不到它。我将函数refreshAfterBet附加到popover中的按钮,但是我错了,当你调用placeStraightBet时应该调用该函数。

here the DOCS for the popover I am using

那我怎么称呼这个popover?

0 个答案:

没有答案