daterangeを使用してテーブルをフィルタリングしようとしていますが、更新するモデルを取得できないため、選択した日付がわかりません。Angular JS datepickerはモデルを更新しません
これは、日付ピッカーポップアップのHTMLです:あなたのtr
要素が間違っている
<tr ng-repeat = 'file in files | startFrom: dt'>
daterangeを使用してテーブルをフィルタリングしようとしていますが、更新するモデルを取得できないため、選択した日付がわかりません。Angular JS datepickerはモデルを更新しません
これは、日付ピッカーポップアップのHTMLです:あなたのtr
要素が間違っている
<tr ng-repeat = 'file in files | startFrom: dt'>
:
<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"></tr>
ます。また、UIB-DatePickerの-ポップアップ指令に誤りがあります。それは次のようになります。それは内蔵の角度フィルタではないよう
uib-datepicker-popup="{{format}}"
これは、あなたが他の場所であなたのモジュールでstartFrom
フィルタを定義していると仮定しています。
はこの試してみてください。
$scope.dt = new Date();
をし、ビューをレンダリングする際にコントローラが起動されていることを確認してください。
こんにちはAndreea。私は$ scope.dtがあなたの$ scopeの中のどんな値にも設定されていないことに気が付きました$ watch function –
こんにちは、私はそれを私のコンソールに記録し、日付。 $ scope.dtに値を代入しても何も変更されませんでしたが、 – Andreea