javascript - uib-popover 意外关闭并显示 "outsideClick"和 uib-datepicker

标签 javascript html angularjs angular-ui-bootstrap

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/

相关文章:

php - 从 AJAX 获取返回值

jquery - 3 列图像 - 在桌面上底部对齐但在调整大小时不对齐

javascript - 当用户输入逗号时,Angularjs 会破坏标签

javascript - 在 JavaScript 中使用 GPS 无法获得准确的位置

javascript - 如何更改 javascript 中文本的颜色?

Javascript 代码在 Mozilla 的同一页面上提交表单

javascript - Jquery 循环数组 - 一定有更好的方法

javascript - 如何使用nodejs将图像文件夹从网站下载到本地目录

html - 如何使用 golang 将未编码的 JSON 连接到 HTML 页面?

带有 TreeView 的 AngularJS 下拉列表