本文介绍了单击图标时,Angular js 和 bootstrap ui 日期选择器未在 chrome 中打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用 bootstrap UI 有角度的日期选择器.此代码在 IE 中运行良好,但在 chrome 中无法打开.在调用方法 open() 后,输入框获得焦点但日期选择器弹出窗口未打开.任何帮助将是非常可观的.提前致谢
I have date picker in angular using bootstrap UI. This code is working very fine in IE but its not get open in chrome. As after calling the method open () input box get focused but date picker popup not opens. Any help will be really appreciable. Thanks in advance
<p class="input-group">
<input is-open="opened" type="text" datepicker-popup="M/d/yyyy" ng-model="Date" datepicker-options="dateOptions" />
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="open()"><i class="glyphicon glyphicon-calendar"></i></button>
</span>
</p>
Java 脚本
$scope.open = function () {
$scope.opened = true;
};
推荐答案
您需要阻止点击事件从按钮传播,因为它会导致日期选择器立即关闭...
You need to stop the click event from propagating from the button as it will cause the datepicker to close instantly...
<button type="button" class="btn btn-default" ng-click="$event.stopPropagation(); open();">
<i class="glyphicon glyphicon-calendar"></i>
</button>
这篇关于单击图标时,Angular js 和 bootstrap ui 日期选择器未在 chrome 中打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!