I am created a Laravel AngularJs application with a search bar;used to search data between two dates.
I am created a AngularJs function in following way.
$scope.searchDateParticular=function()
{
if( $scope.fromDate.toISOString)
$scope.fromDate = $scope.fromDate.toISOString();
if( $scope.toDate.toISOString)
$scope.toDate = $scope.toDate.toISOString();
$http.get('/api/accountParticularWithDate',{account_id:$scope.myAccount.id,fromDate:$scope.fromDate,toDate:$scope.toDate}).
success(function(data,status,headers,config){
$scope.particulars=data;
console.log(data);
}).error(function(data,status,headers,config){
console.log(data);
});
}
But,I got an error in data conversion.I need your help to convert AngularJs date into Universal format.
I solved my problem in following ways:
$scope.searchDateParticular=function(fromDate,toDate)
{
var from = $filter("date")(Date.parse(fromDate), 'yyyy-MM-dd');
var to = $filter("date")(Date.parse(toDate), 'yyyy-MM-dd');
$http.get('/api/accountParticularWithDate',{params:{'account_id':$scope.myAccount.id,'fromDate':to,'toDate':from}})
.then(function(response){
$scope.particulars=response.data;
getTotalStatement($scope.particulars);
//console.log(response.data);
});
}
Now the problem fixed.Thank you for your support for all.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.