我正在用datepicker(JQuery)做一個項目。當我點擊日期選擇器中的日期時,它從不顯示日期,除非輸入空格或輸入。我希望當我點擊日期時,顯示點擊日期。Angularjs和jquery datepicker數據綁定
我希望在datepicker中點擊日期時,輸出會自動顯示日期。但我必須先按下空格鍵它生成/顯示日期。請幫助之前.. 這是我的代碼:
$(document).ready(function() {
$("#datepickerfrom").datepicker({
numberOfMonths: 1,
onSelect: function (selected) {
$("#datepickerto").datepicker("option", selected)
}
});
$("#datepickerto").datepicker({
numberOfMonths: 1,
onSelect: function (selected) {
$("#datepickerfrom").datepicker("option", selected)
}
});
// jQuery object; this demo
});
function GetbyDate(fr, t) {
var from = new Date(t)
};
scope.changeDate = function() {
scope.models = null;
http.get('GetReportList?from=' + scope.filter_fromDate + '&to=' + scope.filter_toDate).success(
function (data) {
scope.models = data;
});
}
<p class="input-group">
<input type="text" class="form-control" id="datepickerfrom" data-ng-model="filter_fromDate" />
<span class="input-group-btn">
<button type="button" class="btn btn-default">
<i class="glyphicon glyphicon-calendar"></i>
</button>
</span>
{{filter_fromDate}}
</p>
<p class="input-group">
<input type="text" class="form-control" id="datepickerto" data-ng-model="filter_toDate" />
<span class="input-group-btn">
<button type="button" class="btn btn-default">
<i class="glyphicon glyphicon-calendar"></i>
</button>
</span>
{{filter_toDate}}
</p>
是jquerydirective也在角?我試着做你說的話。仍然沒有任何改善。 – Mijevoli 2015-02-24 01:15:10