【发布时间】:2017-03-24 18:08:03
【问题描述】:
我有一个非常简单的承诺,它执行,我得到返回响应,在处理返回响应时,就像函数永远不会退出一样。我的测试变得越来越简单,只是将其归结为基础,但问题仍然存在 - 我一生都无法理解为什么要这样做。
isError = 0 ;
// validating corporate ID
if ($scope.installType == 1) {
$scope.errMsg = "Validating Corporate Business ID" ;
document.getElementById('errorMsg').style.textDecoration = 'blink' ;
return apiService.all()
.then(function(response){
var corpData = response[0] ;
if (corpData.rowCount == 1 && corpData.data[0].corpID == $scope.userObj.corp_ID) {
// theoretically a match was found
console.log("no error") ;
} else {
// no match was found
console.log("with error") ;
isError++ ;
}
console.log("isError: "+isError) ; // this prints to console
//return ; // had added this thinking it was stuck inside the promise, still didn't work
}) ;
console.log("hereA") ; // <-- never gets here
}
【问题讨论】:
标签: javascript angularjs httprequest