我正在尝试在angular中使用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
<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
<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
<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时遇到了问题。当我使用popover-trigger属性时,弹出窗口不会出现。但当我删除该属性时,它会起作用。我想关闭弹出窗口,当用户点击页面上的任何地方。我找不到解决这个问题的办法。请帮帮忙。提前谢谢。
发布于 2017-03-23 17:37:19
应从popup-trigger属性中删除click值。
就试试popover-trigger="'outsideClick'"吧
https://stackoverflow.com/questions/42971347
复制相似问题