angularjs - angular changing the url location without reloading the page -


i have partials loaded url templates/test.html example. templateurl relative. want use same templates in different locations within website.

so , want use same relative url http://somedomain.com/templates/test.html if on actual url of http://somedaomian.com/some1/some2

i have tried use $loaction service, unable set $loaction home url when need to.

e.g in controller :

var new_base_url = homeurl();  function homeurl() {    /* here unable home url */    $location.path('/');      // returns current url   }; 

if want absolute url, $location.absurl() return (all url segments).

if want host name, $location.host() return host name.

if want protocol, $location.protocol() return that.

if want path, $location.path() return that.

if want hash, $location.hash() return that.

you should able use these methods parse out pieces of url after.

var path = $location.path(); var hash = $location.hash(); var basepath = path.replace(hash, ''); 

Comments

Popular posts from this blog

jQuery Mobile app not scrolling in Firefox -

c++ - How to add Crypto++ library to Qt project -

php array slice every 2th rule -