[英]Bootstrap datetimepicker / date picker not displaying calendar. Cannot pick a date
[英]Date Picker with a DateTimePicker
我在我的html中有一個選擇日期的指令
angular
.module('App',['ui.date'])
.directive('customDatepicker',function($compile){
return {
replace:true,
templateUrl:'custom-datepicker.html',
scope: {
ngModel: '=',
dateOptions: '='
},
link: function($scope, $element, $attrs, $controller){
var $button = $element.find('button');
var $input = $element.find('input');
$button.on('click',function(){
if($input.is(':focus')){
$input.trigger('blur');
} else {
$input.trigger('focus');
}
});
}
};
})
.controller('myController',function($scope){
$scope.birthDate = '2013-07-23';
$scope.dateOptions = {
minDate: -20,
maxDate: "+1M +10D"
};
});
現在,我想在此DatePicker中插入這樣的時隙,當我選擇一個時隙時,例如返回$scope.time='00h-12'
我不知道該怎么做。
在您的customDatepicker
指令中,您可以直接更新datepicker
,例如$.datepicker.dpDiv.append($("#custom-footer").contents().text());
; 請參閱下面引用的jsfiddle的第21行。
另外,按照您的約定,我將自定義頁腳文本作為模板嵌入腳本標簽中。 參見第7-10行。
使用該解決方案更新了小提琴: http : //jsfiddle.net/haroldcampbell/FVfSL/808/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.