angularjs - How to pass datetime parameter to HTTP GET message -
i want pass 2 datetime parameter form web api angular js not make work. able pass date without time web api method.
my form datetime controls looks below:-
now want pass datetime below angular js:-
angular js call
var starttime = $filter('date')($scope.md_invstarttime, "hh:mm"); starttime = starttime.split(':'); var invstartdate = new date($scope.md_invstart); invstartdate.sethours(starttime[0]); invstartdate.setminutes(starttime[1]); var invbookdate = $filter('date')(invstartdate, "yyyy-mm-ddthh:mm:ss.000") var endtime = $filter('date')($scope.md_invendtime, "hh:mm"); endtime = endtime.split(':'); var invenddate = new date($scope.md_invend); invenddate.sethours(endtime[0]); invenddate.setminutes(endtime[1]); var invbookenddate = $filter('date')(invenddate, "yyyy-mm-ddthh:mm:ss.000") metadataorgfactory.gettriidapicall('checkinvavail', invbookdate, invbookenddate, $scope.md_invid, function (datasuccess) { }, function (dataerror) { });
controller method
[authorize] [route("api/checkinvavail/{invstarttime}/{invendtime}/{invid}")] [httpget] public bool getinvavailability(datetime invstarttime, datetime invendtime,guid invid) { inventorybll checkinv = new inventorybll(); bool isavailable = checkinv.isavailable(invstarttime, invendtime,invid) return isavailable; }
i have searched many articles none solve problem , hence post. helpful if 1 post exact solution problem.
convert date object timestamp var timestamp = datevar * 1
pass timestamp instead. in backend convert timestamp date object.
Comments
Post a Comment