【问题标题】:popover-trigger angular bootstrap not triggering popoverpopover-trigger angular bootstrap 不触发 popover
【发布时间】:2017-03-23 09:00:57
【问题描述】:

我正在尝试以如下角度使用 uib-popover

html模板

          <form id="methodform" style="font-size:large;font-family:'merriweatherregular';color:#2c3e4c">
        <label><input type="radio" ng-model="methodname" value="method1">
          method1&nbsp;
          <i title="show info" class="fa fa-info-circle"
           aria-hidden="true" ng-click="getMethodInfo(1)"
          uib-popover-template="dynamicPopover.templateUrl" popover-placement="right"
          popover-title="{{dynamicPopover.title}}" popover-trigger="'click outsideClick'"></i></label></br>
        <label><input type="radio" ng-model="methodname" value="method2">
          method2&nbsp;
          <i title="show info" class="fa fa-info-circle"
           aria-hidden="true" ng-click="getMethodInfo(2)"
           uib-popover-template="dynamicPopover.templateUrl" popover-placement="right"
           popover-title="{{dynamicPopover.title}}"></i></label></br>
        <label><input type="radio" ng-model="methodname" value="method3">
          method3&nbsp;
          <i title="show info" class="fa fa-info-circle"
           aria-hidden="true" ng-click="getMethodInfo(3)"
           uib-popover-template="dynamicPopover.templateUrl" popover-placement="right"
           popover-title="{{dynamicPopover.title}}"></i></label></br>
      </form>

<script type="text/ng-template" id="myPopoverTemplate.html">
    <div>{{dynamicPopover.content}}</div>
</script>

控制器:

   $scope.getMethodInfo = function(methodId){
     if(methodId==1){
       $scope.dynamicPopover.title = 'Method 1'       
     }else if(methodId==2){
       $scope.dynamicPopover.title = 'Method 2'
     }else{
       $scope.dynamicPopover.title = 'Method 3'
     }
   }

   $scope.dynamicPopover = {
    content: 'Some details about this method',
    templateUrl: 'myPopoverTemplate.html'
  };

我在关闭弹出框时遇到问题。当我使用 popover-trigger 属性时,弹出框不会出现。但是当我删除该属性时它会起作用。当用户单击页面上的任意位置时,我想关闭弹出框。我无法找到解决此问题的方法。请帮忙。 提前致谢。

【问题讨论】:

    标签: angularjs angular-ui-bootstrap popover


    【解决方案1】:

    您应该从popup-trigger 属性中删除click 值。

    试试popover-trigger="'outsideClick'"

    【讨论】:

    • 没用,我也试过用'focus'和'mouseenter'。
    • 你能创建 plunker 吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-25
    • 1970-01-01
    • 2015-10-24
    • 1970-01-01
    • 1970-01-01
    • 2018-07-03
    • 1970-01-01
    相关资源
    最近更新 更多