Let's set up a simple example:
$scope.whatDoesTheFoxSay = function(){
$http.post("/backend/ancientMystery", {
...
How can I globally transform the URL where the post request is sent to? Essentially I want to prepend an URL to every http request.
What I have tried is setting a variable in the $rootScope containing the url when the application starts. But this is not what I want my code to look like:
$scope.whatDoesTheFoxSay = function(){
$http.post($rootScope.backendUrl + "/backend/hidingDeepInTheWoods", {
...
Am I correct assuming that I should look into $httpProvider.defaults.transformRequest? Can anyone provide me with some basic example code?