如果绑定到datepicker-popup,则无法为范围var指定true

时间:2015-07-11 18:38:29

标签: angularjs datepicker angular-ui-bootstrap

我在范围foobar中有两个布尔变量,都设置为false

我为每个按钮创建了2个按钮来设置其值truefalse,但是,如果变量绑定到is-open的属性datepicker-popup,则它无法设置为真。

有人可以告诉我什么错了吗?

以下是plunker的案例。

1 个答案:

答案 0 :(得分:0)

" The issue relates to the fact the the datepicker directive uses the ngModelController but has an isolated scope to support the dateDisabled attribute, which means you can only set the ngModel on the parent element and not on the datepicker element."

在Angular UI Bootstrap Repo上的Github上看到here

以下是基于回购反馈和"修复":http://plnkr.co/edit/DA1E9RlE8gYBpgc39eH0?p=preview

在我看来像现在工作状态的演示

我将ng-model应用于父节点,在这种情况下是您的<body>元素

以下是工作的屏幕截图:

enter image description here