为日期选择器,弹出问题的角度定制指令 [英] Angular custom directive for Datepicker, popup issue

查看:157
本文介绍了为日期选择器,弹出问题的角度定制指令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经用角UI日期选择器自定义指令。
角UI日期选择器弹出应该得到按钮单击事件打开。这个按钮点击事件被解雇和是开放布尔值被设置为true,但弹出窗口不显示。
请指教。

I have created a custom directive using angular UI datepicker. Angular UI datepicker popup should get opened on button click event. This button click event is getting fired and is-open boolean value is being set to true, But the popup is not showing. Please advise.

Plunker链接: http://plnkr.co/edit/wszoqlmIzS6h3majJrnN?p= preVIEW

Plunker Link: http://plnkr.co/edit/wszoqlmIzS6h3majJrnN?p=preview

推荐答案

我认为问题是按钮的事件传播,这可能是由 $ event.stopPropagation()pvented $ P $; 。我已经有了一个<一个href=\"http://stackoverflow.com/questions/26681001/angular-ui-bootstrap-datepicker-show-on-button-click-without-function\">similiar问题它可以解决你的问题。

I think problem is the event-propagation of the button, which could be prevented by $event.stopPropagation();. I already had a similiar issue which could solve your problem.

我已经更新了 plunkr 这是现在的工作。

I have updated the plunkr which is now working

在在官方文件你也可以找到以下行的例子code的:

In the example in the official documentation you can also find the following lines of code:

$scope.open = function($event) {
    $event.preventDefault();
    $event.stopPropagation();

    $scope.opened = true;
};

这篇关于为日期选择器,弹出问题的角度定制指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆