我想使用daterange过滤表,但不能更新模型,因此它不知道我选择了哪个日期。Angular JS datepicker不更新模型
这是日期选择器弹出窗口中的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没有设置为你的$范围内的任何值$ watch function –
嗨,我删除了,这是我用来记录它到我的控制台,看看它是否检测到变化时,我选择不同日期。为$ scope.dt赋值并不会改变任何内容 – Andreea