.factory('someFac', function (CONFIG, $injector, $http) {
return $http.get('url').then(function (response) {
var temp = response.data.answer;
var answer = '';
if(temp == bar){
answer = barAnswer;
}
else if(temp == foo){
answer = fooAnswer;
}
return $injector.get(answer);
}
}
So my problem is, the $http.get isn't finished getting the response before the factory is finished executing...how should I fix this? I read somewhere I could implement the app.config to inject variables into a provider...could that be a solution?