如何在angularjs应用程序中为bootstrap popover添加自定义标头

时间:2016-03-11 08:53:50

标签: twitter-bootstrap bootstrap-popover angularjs-bootstrap

我们如何在bootstrap的popover中添加自定义标头..我使用下面的代码,我想添加一些链接的自定义标题:

<script type="text/ng-template" id="abc.html">

        <div class="form-group">


            <div class="popover-grid-block">
               <p>Test</p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default btn-sm btn-primary" title="SAVE" ng-click="SaveTestPlanData()" data-dismiss="popover">
                    <span aria-hidden="true" class="glyphicon glyphicon-floppy-disk"></span> {{ 'Save' | translate }}
                </button>

                <button type="button" title="CLOSE" class="btn btn-default btn-sm trigger" popover-close data-dismiss="popover">
                    <span aria-hidden="true" class="glyphicon glyphicon-eye-close"></span>
                </button>
            </div>
        </div>
    </script>

1 个答案:

答案 0 :(得分:1)

您可以尝试这样做。

angular.module('bootstrap.demo', ['ngAnimate', 'ui.bootstrap']);
angular.module('bootstrap.demo').controller('PopoverDemo', function ($scope) {
});
<!doctype html>
<html ng-app="bootstrap.demo">
  <head>
    <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.js"></script>
    <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular-animate.js"></script>
    <script src="//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.13.4.js"></script>
    <script src="example.js"></script>
    <link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
  </head>
  <body style="margin:100px">

  <div ng-controller="PopoverDemo">
  
    <button popover-template="'popover.html'" 
            popover-placement="right" 
            popover-trigger="mouseenter" 
            type="button"
            class="btn btn-default">Mouse over me</button>
      
    <script type="text/ng-template" id="popover.html">
      <div>
        <div class='header'>
          Custom Header
        </div>
        <hr>
        <div class='content'>
          Your custom Data with header and footer
        </div>
      </div>
    </script>
  </div>
</body>
</html>