In angular1, we define constants in this fashion,
angular.module('taskApp', [
'ui.router',
'angular-loading-bar',
'ngMessages',
])
.constant('url', {
BASE: 'http://localhost:3222',
BASE_API: 'http://localhost:3222/v1'
});
then I can inject it into any module I want like so,
Auth.$inject = ['$http', 'url'];
function Auth($http, url)
Now using typescript, I'd like to do the same, I've seen this approach: Inject Angular Constants in TypeScript, which seems to be okay, but not the approach i'm looking for.
From my research
static $inject = ["$resource", "url"];
constructor(private $resource: ng.resource.IResourceService, private url: ng.IModule)
I'm using IModule, because it is the only hint from angular's tsd file
/**
* Register a constant service, such as a string, a number, an array, an object or a function, with the $injector. Unlike value it can be injected into a module configuration function (see config) and it cannot be overridden by an Angular decorator.
*
* @param name The name of the constant.
* @param value The constant value.
*/
constant(name: string, value: any): IModule;
constant(object: Object): IModule;
but can't find right property to retrieve my variables
