我在angular.js上有一个日期选择器:
<input type="text"
class="form-control"
datepicker-popup="{{format}}"
ng-model="dt"
is-open="opened"
min-date="minDate"
max-date="'2015-06-22'"
datepicker-options="dateOptions"
date-disabled="disabled(date, mode)"
ng-required="true"
close-text="Close">
当我第一次点击按钮时,效果很好,但是当我再次点击时,它确实有效。
我试试这个:
$scope.open = function ($event) {
$event.preventDefault();
$event.stopPropagation();
$scope.opened = true;
};
和此:
$scope.open = function ($event) {
$event.stopPropagation();
$scope.opened = true;
};
答案 0 :(得分:1)
因为您的按钮执行相同操作,即将变量设置为true,因此您不会在屏幕上产生任何影响。试试这个:
$scope.open = function ($event) {
//change this
$scope.opened = !$scope.opened;
$event.preventDefault();
$event.stopPropagation();
};