My attempts to filter my ng-repeat
items using the uploadDate
have been unsuccessful. I have tried everything, but it always fails. I am seeking assistance from someone who can help me resolve this issue.
Controller
ExtractionService.getUserUploadedData(d).then(function (msg) {
angular.forEach(msg.data, function (val) {
var src = val.uploadDate;
src = src.replace(/[^0-9 +]/g, '');
var uploadDate = new Date(parseInt(src));
console.log(uploadDate); //it returns a ISO date string format
var dd = {
uploadDate: uploadDate,
filename: val.filename,
bch: val.bch,
Id: val.edmId
}
$scope.datalistings.push(dd);
})
});
HTML
<md-datepicker ng-model="search.uploadDate" ng-change="search.uploadDate = (search.uploadDate.toISOString())" md-placeholder="Enter Date" md-open-on-focus></md-datepicker>
In the code above, I attempted to convert the
search.uploadDate
model to an ISO string date format using.toISOString()
, however, it failed to properly filter the results in the ng-repeat loop.
<tr ng-repeat="info in filtereddata = (datalistings | filter: {uploadDate:search.uploadDate})" class="animate-repeat">
<td>{{$index+1}}</td>
<td>{{info.uploadDate}}</td>
<td>{{info.filename}}</td>
<td>{{info.bch}}</td>
</tr>
I also tried converting the info.uploadDate
like this
{{info.uploadDate.toISOString()}}
, but unfortunately, that approach also did not work. Can anyone provide some insight or assistance?