user2957271
user2957271

Reputation: 192

Change request url for static resource with angular2+

Is there a way with angular2+ to change the url of all static resource requests (for example an image src in DOM)? The goal is to change the url of a resource from "assets/images/image.jpg" to "/app-name/assets/images/image.jpg". I have found httpInterceptors but it works only with api requests.

Upvotes: 0

Views: 276

Answers (1)

sonu singhal
sonu singhal

Reputation: 211

You can use base <base href="/antpath/"> in your index.html

then the value in href (/antpath/) will be appended to all your request.

Upvotes: 1

Related Questions