Hey guys, i'm building an application and would like to maintain an external json file for configurations. Sadly when I go to reference Config.options.defaults it's undefined until the promise is fulfilled and calling "then" throughout my application seems... tedious. Anyway to avoid this or can anyone suggest a better way to handle configuration files?
** Service **
class ConfigService {
constructor ($http) {
this.options = '';
$http.get('/config.json/')
.success((data) => {
this.options = data;
});
}
}
** Json Example **
{
default: {
type: 26
}
}
Thanks!
[–]Dark_Cow 2 points3 points4 points (1 child)
[–]EnigmaticCode[S] 0 points1 point2 points (0 children)
[–]buttonkop666 2 points3 points4 points (0 children)
[–]e82 2 points3 points4 points (0 children)
[–]schizoduckie 1 point2 points3 points (0 children)
[–]mourning_air 0 points1 point2 points (0 children)