I am writing a web app with a java servlet back end and I am checking out angular for the front end. Since the address to a specific resource within a servlet depends on what servlet context it is placed in, I am wondering if it is possible to change the base url for all angular functions.
If I create a link in my webapp
<a href='/newaccount'>Create new account</a>
Actually there are two routing - one on backend and one on frontend. Aren't you missing them?
When you're configuring
$routeProvider in AngularJS, you're configuring client-side routing, so urls would be kind of
[hostname]/anypath/yourpage/#/newaccount (if you're using HashBang mode, that is default in AngularJS).
But of course you can change base. Plunker, for example use this way:
<script> document.write('<base href="' + document.location + '" />'); </script>
More information, including HTML5 and HashBang mode you can find here: https://docs.angularjs.org/guide/$location (there is also note about
<base> and Html link rewriting)