【发布时间】:2016-07-22 08:50:21
【问题描述】:
我正在尝试使用日期范围过滤表格,但无法让模型更新,因此它不知道我选择的日期。
这是日期选择器弹出窗口的 HTML:
<label>From:</label>
<p class="input-group" style="width:200px">
<input type="text" class="form-control" uib-datepicker-popup = "{{format}}" ng-model="dt" is-open="status.opened"
min-date="minDate" max-date="maxDate" 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>
我的控制器中的 JS 代码:
(function ()
{
'use strict';
angular.module('aml-tech-dashboard.successful-emails').controller('datepickerController', function ($scope) {
$scope.dt = '';
$scope.status = {
opened: false
};
$scope.format = "yyyy-MM-dd"
$scope.minDate = new Date();
$scope.dateOptions = {
//formatYear: 'yy',
startingDay: 1
};
$scope.open = function ($event) {
$scope.status.opened = true;
};
});
})();
表:
<tr ng-repeat = 'file in files | startFrom: dt'>
【问题讨论】:
-
嗨,安德烈亚。我注意到 $scope.dt 没有设置为 $scope.$watch 函数中的任何值
-
嗨,我删除了它,我以前只是将它记录到我的控制台,看看当我选择不同的日期时它是否检测到变化。为 $scope.dt 赋值并没有改变任何东西
标签: javascript angularjs