AngularUI日期选择器允许键入超出范围的值 [英] AngularUI datepicker allows typing value outside of range

查看:57
本文介绍了AngularUI日期选择器允许键入超出范围的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用AngularUI指定带有某些允许的输入值范围的datepicker时遇到问题.例如,用户可以选择2013年6月10日至2013年6月20日之间的日期.只要用户在日期选择器内部单击,此方法就可以正常工作,但是当用户键入超出范围的日期时,它将无法正常工作.在这种情况下,它将把模型更新为键入的值,但会还原为ui中的范围.

I'm having an issue where I'm using AngularUI to specify a datepicker with some allowed range of input values. For example, the user can select a date from 2013-06-10 to 2013-06-20. This works fine as long as the user is clicking inside the datepicker, but it does not work correctly when the user types a date outside of the range. In that case it will update the model to the typed value but revert back to the range in the ui.

以下是一个演示该问题的plnkr: http://plnkr.co/kmU8vM6OGNsus0Upp02g .尝试输入超出允许范围的值.

Here's a plnkr that demonstrates the issue: http://plnkr.co/kmU8vM6OGNsus0Upp02g. Try typing a value that is outside of the allowed range.

还有其他人遇到过这个问题吗?是否有错误修正或解决方法?

Has anybody else experienced this problem? Is there a bugfix or workaround?

推荐答案

此问题已通过新的插件版本解决: https://github.com/angular-ui/ui-date .因此,解决方案是停止使用捆绑的" angular-ui,而开始使用插件版本.

This has been solved with the new plugin version: https://github.com/angular-ui/ui-date. So solution is to stop using "bundled" angular-ui and instead start using the plugin versions instead.

这篇关于AngularUI日期选择器允许键入超出范围的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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