2

I have a scenario where I have a "parent" datepicker and a bunch of "child" datepickers, all within the same view. I will need to update the child pickers to be limited by the parent's date and the parent picker will need to be governed by the highest child date. I've tried setting this on the children pickers:

//child pseudo-code
<input data-date-end-date="parent.target_date" data-ng-model="child.target_date bs-datepicker />

//parent pseudo-code
<input data-date-start-date="highestChild.target_date" data-ng-model="child.target_date bs-datepicker />

but i just get a picker without the ability to select anything.

essentially a child should not be able to be put out passed it's parent and a parent can't be pulled in closer than it's highest child, but they all need to be able to update.

4

1 回答 1

0

您的代码的部分问题是 Angular-Strap 不使用data-date-*属性,它使用data-*,不幸的是,目前没有很好的文档记录(如果有的话)。

另一个问题是start-dateandend-date属性通常可以通过输入静态日期(例如data-date-start-date="2013-09-03". Angular-Strap 的工作方式与许多其他 Angular 指令相同,它允许您像没有 Angular 时一样使用属性,但允许您通过使用双花括号来使用 Angular 表达式。

例如ng-href="http://www.waddup.com/items/{{ item.number }}"

您的伪代码最终应该是这样的:

//child pseudo-code
<input
    data-end-date="{{ parent.target_date}}"
    data-ng-model="child.target_date"
    bs-datepicker
/>

//parent pseudo-code
<input
    data-start-date="{{ highestChild.target_date }}"
    data-ng-model="parent.target_date"
    bs-datepicker
/>
于 2013-08-07T14:20:47.283 回答