uib-datepicker-popup在我的角度应用中不起作用,我在其他控制器中工作
<input ng-click="open($event, 'delivery_time_popup')" type="text" class="form-control" uib-datepicker-popup="dd-MMMM-yyyy" show-weeks="false" ng-model="purchase_order.delivery_time" is-open="delivery_time_popup" datepicker-options="dateOptions" required close-text="Close" placeholder="Select Date">
JS
$scope.open = function ($event, opened) {
console.log(opened);
$event.preventDefault();
$event.stopPropagation();
$scope[opened] = true;
};
$scope.delivery_time_popup = false;
$scope.dateOptions = {
formatYear: 'yy',
startingDay: 1
};
答案 0 :(得分:0)
您需要在$scope.delivery_time_popup
函数中将open
值更改为true。
$scope.open = function ($event, opened) {
console.log(opened);
$event.preventDefault();
$event.stopPropagation();
$scope[opened] = true;
$scope.delivery_time_popup = true; //add this
};
您的html中的会将ng-click
更改为ng-focus
<强> HTML 强>
<input ng-focus="open($event, 'delivery_time_popup')" type="text" class="form-control" uib-datepicker-popup="dd-MMMM-yyyy" show-weeks="false" ng-model="purchase_order.delivery_time" is-open="delivery_time_popup" datepicker-options="dateOptions" required close-text="Close" placeholder="Select Date">
<强> CONTROLLER 强>
$scope.open = function ($event, opened) {
console.log(opened);
$event.preventDefault();
$event.stopPropagation();
$scope[opened] = true;
$scope.delivery_time_popup = true;
};
$scope.delivery_time_popup = false;
$scope.dateOptions = {
formatYear: 'yy',
startingDay: 1
};
});