I'm using ngx-restangular with Angular v6. I want to implement a service that intercepts the requests that are sent through the restangular and in some cases, use a caching method.
For Angular's HttpClientModule I can do that with an interceptor like this link, but as I'm using ngx-restangular, this method won't work. Also in the documentation of ngx-restangular there's no interceptor that is able to prevent sending the request. There's just fullRequestInterceptor
which is used to change the sent request and AFAIK it's not able to prevent the request and set a custom observable as the response.
So how can I implement a caching mechanism in ngx-restangular?
I finally decided not to use ngx-restangular
at all. I created a wrapper for HttpClientModule
with an interface similar to the interface of ngx-restangular
and implemented cache by the sharing observable of requests.