我有两个字段,一个是文本框,另一个是datefield。 如果我从文本框到日期字段标出,日期选择器显示日期的乞讨(1899年12月)。但我的要求是显示当前日期。
但它使用参数 data-date =" 21/04 / 2015" 处理静态数据。但不使用动态数据。即(data-date =" date")
$scope.assignedDate = new Date();
$scope.dates = $filter('date')($scope.assignedDate, "dd/MM/yyyy");
<div class="input-group date form_date" data-date="dates" data-date-format="dd/mm/yyyy" data-ng-model="checkDate" date-picker="{weekStart: 1,todayBtn: true, autoclose: true, todayHighlight: true, startView: 2, minView: 2}" date-picker>
<input type="text" id="chqdt" name="chqdt" class="form-control input-appen inputDatepicker" placeholder="Date" data-ng-model="checkDate" data-ng-disabled="optionalSearch == 'bankCode'" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar add-on"></span>
</span>
</div>
app.directive('datePicker', function () {
return {
// Restrict it to be an attribute in this case
restrict: 'A',
// responsible for registering DOM listeners as well as updating the DOM
link: function(scope, element, attrs) {
$(element).datetimepicker(scope.$eval(attrs.datePicker));
}
};
});
http://www.malot.fr/bootstrap-datetimepicker/