Whats the better way to identify the context path in Angular JS

后端 未结 7 1044
清酒与你
清酒与你 2021-02-05 20:38

I have my web application deployed to tomcat with an applicatio context. For example my URL looks something like this.

http://localhost:8080/myapp
相关标签:
7条回答
  • 2021-02-05 21:23

    In Angular 2 (if using hashbang mode). Below code can be used to form the url.

    document.location.href.substr(0, document.location.href.lastIndexOf("/#")) + "/getusers";
    

    Inspired from the answer of @jarek-krochmalski

    0 讨论(0)
提交回复
热议问题