Using Angular $http service as documentLoader

Hi

I'm trying to use the jsonld with Angular and in tests I want to
replace the default documentLoader with $http service so that I can
mock the responses.

I assumed that because $http already returns a promise it would be
enough to simply use a function like

jsonld.documentLoader = function (url) {
   return $http.get(url);
}

as replacement for whatever is currently set.

Unfortunately it doesn't work. What's would be correct way to do that?

Or alternatively is there another good way for me to mock responses?

Thanks,
Tom

Received on Wednesday, 18 June 2014 21:55:08 UTC