W3C home > Mailing lists > Public > public-linked-json@w3.org > June 2014

Using Angular $http service as documentLoader

From: Tomasz Pluskiewicz <tomasz@t-code.pl>
Date: Wed, 18 Jun 2014 23:20:49 +0200
Message-ID: <CAAFOhSc7KZ4OO_X1PaT438SmeAPBhe-aE48FpbrLjZyZQvxXgw@mail.gmail.com>
To: public-linked-json@w3.org

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?

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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:18:41 UTC