AngularUI动态日期选择器禁用日期 [英] AngularUI Datepicker dynamic date disabling
问题描述
我使用的是AngularUI日期选择器。
I am using the AngularUI datepicker.
我有相互影响另外两个datepickers。一个例如是开始日期,另一个是结束日期。相反,这两个datepickers创建的验证,我想消除其(早于开始日期,反之亦然,即最后一天)无效日期的选择。
I have two datepickers that influence each other. One is for example a "start date" and the other is an "end date". Instead of creating validation for both datepickers, I want to eliminate the option of having invalid dates (i.e. end date earlier than the start date and vice versa).
有没有办法重新触发选择日期之日起禁用属性? (重触发日期禁用其他日期选择器的)
Is there a way to re-trigger the date-disabled attribute on select of a date? (re-trigger the date-disabled of the OTHER datepicker)
我plunkr:我有一个开始和结束日期,因为你可以看到,当你打开每个日期选择器,你不能选择的开始日期在结束日期越高,反之亦然。但是,如果我改变我的开始日期为11/21,我想结束日期的日期选择器来更新,使得11/20不再点击。有没有办法做到这一点?
My plunkr: I have a start and end date, as you can see when you open each date picker, you cannot pick a start date higher than the end date and vice versa. However if I change my start date to 11/21, I want the end date's datepicker to update so that the 11/20 is no longer clickable. Is there any way to do this?
http://plnkr.co/edit/TgisJnSwQItDeCuIReLL?p=$p$ PVIEW
推荐答案
这是可能做到这一点使用最小值和最大值结合看采摘属性值。
看<一个href=\"http://plnkr.co/edit/W5pb1boMLOHZFnWkMU8o?p=$p$pview\">http://plnkr.co/edit/W5pb1boMLOHZFnWkMU8o?p=$p$pview
It is possible to do this using min and max attributes in combination with watching pickers' values. Look at http://plnkr.co/edit/W5pb1boMLOHZFnWkMU8o?p=preview
这篇关于AngularUI动态日期选择器禁用日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!