uib-Popover 意外关闭,其中包含 popover-template、“outsideClick”触发器和 uib-Datepicker:事实上,当单击日期选择器本身时,popover 意外关闭。
这里是打开弹出窗口的按钮:
<div style="text-align:center;">
<button uib-popover-template="'myPopoverTemplate.html'" popover-title="Popover title" type="button" class="btn btn-default" popover-trigger="outsideClick" popover-placement="bottom" >Open me</button>
</div>
和弹出框模板:
<script type="text/ng-template" id="myPopoverTemplate.html">
<div class="form-group">
<uib-datepicker ng-model="dateTime" class="well well-sm"></uib-datepicker>
</div>
{{dateTime | date}}
</script>
plnkr 中的完整代码:http://embed.plnkr.co/ESto8dgDbh52g0nl7g03/
这是 Angular 引导的错误还是我遗漏了一些东西?我已经在 Angular Bootstrap github 上提出了一个问题,你可以在这里关注: https://github.com/angular-ui/bootstrap/issues/5979
最佳答案
我发现这已经是 aswered在 github 上。
下面我将分享 Angular Bootstrap 的主要贡献者之一 Wesleycho 的回答:
You have to manually stop the click event propagation.
更实际的是,您需要添加一个
ng-click="$event.stopPropagation()"
在 uib-datepicker 的父元素上。
可以找到此解决方案的快速示例 here (由wesleycho本身提供)。
关于javascript - uib-popover 意外关闭并显示 "outsideClick"和 uib-datepicker,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37745295/