0

I am using angularjs bootstrap popover inside a table.

The table is populated using ng-repeat and if the popover is open and i get new data to the table there is a flicker to the popover.

Here is a working example Pknkr

Any thought on how can i prevent the flicker ?

<!doctype html>
<html ng-app="ui.bootstrap.demo">
  <head>
    <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.js"></script>
    <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-animate.js"></script>
    <script src="//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-2.0.0.js"></script>
    <script src="example.js"></script>
    <link href="//netdna.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
  </head>
  <body>

<div ng-controller="PopoverDemoCtrl">
  <br/>
  <br/>
  <table>
    <tr ng-repeat="item in list">
      <td>
        <button uib-popover-template="dynamicPopover.templateUrl" 
                popover-is-open="aux.openPopOverId==item.id" 
                ng-click="aux.openPopOverId=item.id" popover-placement="right" type="button" class="btn btn-link">
          Popover
        </button>
      </td>
    </tr>
  </table>

    <script type="text/ng-template" id="myPopoverTemplate.html">
        <div>{{dynamicPopover.content}}</div>
        <div class="form-group">
          <label>Popup Title:</label>
          <input type="text" ng-model="dynamicPopover.title" class="form-control">
        </div>
    </script>
</div>
  </body>
</html>

And the js

angular.module('ui.bootstrap.demo', ['ngAnimate', 'ui.bootstrap']);
angular.module('ui.bootstrap.demo').controller('PopoverDemoCtrl', function ($scope,$interval, $sce) {
  $scope.dynamicPopover = {
    templateUrl: 'myPopoverTemplate.html',
    title: 'Title'
  };

  $scope.list = [{'id':1},{'id':2},{'id':3}];
  $scope.aux = {'openPopOverId':2};

  $scope.updateList = function(){
    $scope.list = [{'id':1},{'id':2},{'id':3}];
  }

  $interval($scope.updateList,500,0);
});
yossi
  • 12,945
  • 28
  • 84
  • 110

1 Answers1

1

I thought this could be help you please read here in detail..

enter image description here

Sunny S.M
  • 5,768
  • 1
  • 38
  • 38