2014-10-14 1 views
0

내 코드가 의도 한대로 작동합니다. return cachedPromise[reqKey] = $http.get(apiUrl) 을 다시 쓰면 어떻게 jsLint가 경고를 던지지 않습니다. 차라리이 오류를 막지 않을 것입니다.jslint가 할당 경고 대신 조건을 반환하지 않도록 함수를 다시 작성하는 방법

return cachedPromise[reqKey] = $http.get(apiUrl) 
    .then(function(result){ 
     console.log('http then results', result.data); 
     return result.data; 
    }, function(data, status){ 
     return $q.reject('error in teh gifson' + 'data: ' + data + 'status: ' + status); 
    }) 
    .finally(function(){ 
     delete cachedPromise[reqKey]; 
    }); 

답변

2

매우 간단합니다 :

cachedPromise[reqKey] = $http.get(apiUrl)...; 
return cachedPromise[reqKey]; 
관련 문제