I have a directive that looks at configuration to figure out what template to use. It used to work great; I had a Config service that just returned an object with config values, and then I did something like this:
if (Config.Values.ReleaseVersion < 1.0) {
template = 'partials/pagebeta.html';
}
else {
template = 'partials/page.html';
}
templateUrl: template
Recently a problem was introduced. My Config service has to get values from a json file. Now because getting config is async, I am now passing back a promise from the Config service. This is creating problems for me in my directive - I can't do this:
var template;
Config.then(function(config) {
if (config.Values.ReleaseVersion < 1.0) {
template = 'partials/pagebeta.html';
}
else {
template = 'partials/page.html';
}
});
templateUrl: template
Any suggestions are appreciated!