我正在使用来自UI Bootstrap的datepicker指令。当我从datepicker按钮中选择日期时,我想从SQL Server DB返回所有数据。我如何通过传递来获取所选日期的数据?
首先是我的观点:
<div class="row">
<div class="col-md-6">
<p class="input-group">
<input type="text"
class="form-control"
datepicker-popup="{{format}}"
ng-model="search.dt"
is-open="opened"
min-date=""
max-date="''"
datepicker-options="dateOptions"
date-disabled="disabled(date, mode)"
ng-required="true"
close-text="Close"
/>
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="open($event)"><i class="glyphicon glyphicon-calendar"></i></button>
</span>
</p>
</div>
</div>
...
//Here comes the ngRepeat directive with the table list
<tr ng-repeat="report in repDay | filter: search">
<td>{{ report.datum | date:'dd.MM.yyyy' }}</td>
...
</tr>
...
最后控制器:
/* GET all data from the database table */
$scope.repDay = resService.query();
//date format
$scope.format = 'dd.MM.yyyy';
// Button Open
$scope.open = function ($event) {
$event.preventDefault();
$event.stopPropagation();
$scope.opened = true;
};
$scope.dateOptions = {
formatYear: 'yy',
startingDay: 1
};
我猜这个问题是来自日期格式不是吗?因为当我试图从选择器中选择一个日期时,数据结果为空,表格也是如此。