How do I set the baseUrl for Angular HttpClient?

后端 未结 6 1877
甜味超标
甜味超标 2021-01-30 06:21

I did not find a way in the documentation to set the base API URL for HTTP requests. Is it possible to do this with the Angular HttpClient?

6条回答
  •  鱼传尺愫
    2021-01-30 07:03

    I think there is no default way to do this. Do the HttpService and inside you can define property of your default URL, and make methods to call http.get and others with your property URL. Then inject HttpService instead of HttpClient

提交回复
热议问题