There are some methods, such as the use of $rootScope
(which is the most common and also the worst) that creates a global variable.
But you can also (in fact, MUST) use a constant
for this purpose, as long as you are sure that the variable will never change, which is your case.
In this file you can define not only one, but several variables to be accessed later. See the example:
var app = angular.module('app', []);
app.constant('minhaConstant', {
url: 'meu/caminho/arquivo.php',
error: 'Algo deu errado, tente novamente',
title: 'Meu Título'
});
And when you need to use it, you should do the constant injection, just like any other case, see:
app.controller('mainController', function(minhaConstant, $scope, $http){
$scope.title = minhaConstant.title;
$http.get(minhaConstant.url).then(function(response){
console.log(response.data);
});
})
In the example I will declare other variables, such as title and standard error message, just so you know you can use it this way.