Reputation: 1341
I have a angularjs service:
angular.module('myApp.services', ['ngResource'])
.factory('Scheduler', function ($resource) {
return $resource('/api/scheduler/:id', {id:'@id'}, {
'get' :{method:'GET', isArray:false},
'save' :{method:'PUT'}
});
})
which returns the following json:
{
'start': '08:00:00',
'end': '21:30:00',
'offset': 5
}
Is there e preferred way in angularjs to convert the 'start date' and the 'end date' in a js Date Object and back to a string right before 'save' it back to the webservice?
Some kind of function which is called right before?
Upvotes: 0
Views: 362
Reputation: 117370
It it not supported by the $resource
service at the moment, use the $http instead. With $http
you can have request and response transformers.
Upvotes: 2