0

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?

1 Answer 1

2

It it not supported by the $resource service at the moment, use the $http instead. With $http you can have request and response transformers.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.