I have an angular app that is hosted at my university server.
Because the app is not in domain root (urls are constructed as follows: university.domain/~<student_id>
) all links and image srcs are broken (angular assumes that it is located in domain root).
My question is: how can I override angular base url so I can still use goodies like ng-href, ng-src etc.?
Quoting the AngularJS documentation:
Relative links
Be sure to check all relative links, images, scripts etc. You must either specify the url base in the head of your main html file (
<base href="/my-base">
) or you must use absolute urls (starting with /) everywhere because relative urls will be resolved to absolute urls using the initial absolute url of the document, which is often different from the root of the application.
More here on the official documentation.
<base href="university.domain/~12345678" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With