정규 개체 또는 http 요청 개체를 반환하는 함수가 있습니다.내 경우에 개체를 반환하는 방법?
나는 반환 된 개체는 HTTP 요청하거나 일반 객체를 통해 경우
var t = function() {
var obj
var test;
//code to determine test value
//return object depends on test value,
//if test is undefined, return regular obj,
//if not make a http request.
if (!test){
return obj;
}
return getObj(url)
.then(function(obj){
return obj
})
}
var getObj = function() {
return $http.get(url);
}
var open = function() {
//this won't work for regular object, it has to be http object
return t()
.then(function(obj) {
return obj;
})
}
var obj = open();
같은 것을 어떻게 확인할 수 있나요?
도움 주셔서 감사합니다.
완전히 고마워요! – BonJon