We have demo and live sites when we deploy application to demo it should work in demo like wise in live. demo url will be like demo.xxxx.com and live will be like xxxx.com.
In angular service layer i'm calling asp.net webapi methods to access data. So I need to prepare url for this I need current domain (app root path). So that I can prefix this path to the webapi path hence I can call webapi method.
You can use the $location service for that.
$log.info($location.absUrl());
$log.info($location.protocol() + "://" + $location.host() + ":" + $location.port());
But if you use relative URLs starting with a '/' to access your back-end, you should also get the behavior you want.
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