servlets - Is it possible to change the base url in angular? -
i writing web app java servlet end , checking out angular front end end. since address specific resource within servlet depends on servlet context placed in, wondering if possible alter base of operations url angular functions.
example: if create link in webapp <a href='/newaccount'>create new account</a>
, configure route provider accordingly $routeprovider.when('/newaccount', ...
want work no matter servlet context servlet placed in. if place servlet in context called "mycontext" actual url resource [hostname]/mycontext/newaccount
.
can somehow setup angular , pass in context name prepended locations , configured routes? way servlet placed in different contexts , still work.
actually there 2 routing - 1 on backend , 1 on frontend. aren't missing them?
when you're configuring $routeprovider
in angularjs, you're configuring client-side routing, urls kind of [hostname]/anypath/yourpage/#/newaccount
(if you're using hashbang mode, default in angularjs).
but of course of study can alter base. plunker, illustration utilize way:
<script> document.write('<base href="' + document.location + '" />'); </script>
more information, including html5 , hashbang mode can find here: http://docs.angularjs.org/guide/dev_guide.services.$location (there note <base>
, html link rewriting)
servlets angularjs
No comments:
Post a Comment