Answer the question
In order to leave comments, you need to log in
How to get json config before sending all $http requests?
Hello!
The task is as follows: locally in the json file is the configuration of requests to the server (address, prefixes, etc.). You must get this file via $http.get before any $http requests and write the configuration to an object (no matter where).
Requests can be in the ui-router resolve, so they can go before the json is received (the request for it goes in the run block).
I write the resulting configuration to $httpProvider.interceptors - so that all requests occur with this configuration. In $httpProvider.interceptors I can't make a request to $http to get the json config - vicious circle.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question