I want to reference the names for a constant by using static data, but it does not work out, because of the execution order. How should this be done.
module tasks {
export class TasksController {
//name of the controller used for referencing or defining this controller
public static named: string = 'tasksController';
public static templateUrl: string = 'apps/demo/tasks/tasks.tpl.html';
//dependencies to other services etc., referenced in the constructor
static $inject: string[] = ['tasksConfig'/*TasksConfiguration.named*/];
//constructor getting injected dependency instances
constructor(appConfig: ApplicationConfiguration) {
}
}
angular
.module('Tasks', [])
.controller(TasksController.named, TasksController);
}
module tasks {
export class TasksConfiguration {
//id of the configuration used for referencing or defining
public static named = 'tasksConfig';
public static values: ApplicationConfiguration = {
appId: 'demo.tasks',
appName: 'App_Name_Tasks',
appCategory: 5,
rootUrl: '/tasks'
};
}
angular.module('Demo')
.constant(TasksConfiguration.named, TasksConfiguration.values);
}
The $inject does not work, when I use TaskConfiguration.named instead of 'taskConfig' because it is not initialised, when the interpreter reaches the line. But what can I do instead?