0
角度jsを初めて使用しています。 日付ピッカーを使用して日付カスタムフィルタを実装しようとしています。 私はそれを試しましたが、うまく動かすことはできません。 以下は私のコードです。ここで日付検索フィルターが角度jsで動作していません
<div class="col-sm-2 m-b-xs">
<input type="text" name="from_date" class="form-control" placeholder="From" date-time view="date" auto-close="true" min-view="date" ng-model="from_date" format="MMM-DD-YYYY" readonly />
</div>
<tr class="gradeU" ng-repeat="x in invoice | filter:{created : from_date}">
<td style="text-align: center;">{{ x.created | datetime }}</td>
</tr>
JS SECTION
function InvoiceControllers($scope, $stateParams, $http, $state) {
$scope.filterData = {};
$scope.invoice_listing = function (data) {
var json = (function() {
var json = null;
$.ajax({
'async': false,
'global': false,
'url': 'invoices/listing_invoice',
'data': data,
'dataType': "json",
'success': function (data) {
// alert(data);
json = data;
}
});
return json;
})();
//$scope.formData = {value : json};
$scope.invoice = json;
};
var data = {};
$scope.invoice_listing(data);
$scope.filter_invoice = function() {
var data = $scope.filterData;
$scope.invoice_listing(data);
};
}
function dateTime($filter) {
return function (input) {
if (input == null) {
return "";
}
var _date = $filter('date')(new Date(input), 'MMM-dd-yyyy');
return _date.toUpperCase();
};
}
angular
.module('inspinia')
.controller('InvoiceControllers', InvoiceControllers)
.filter('datetime', dateTime);
私は、日付部分からの検索パーツを試してみました。あなたの入力フィールドにfrom_date
セットのモーダル値ので
どれ提案.Thankあなた
「return _date;」を使用してください。代わりに "return _date.toUpperCase();" in dateTime関数です。 –