questions are as follows
<input type="text" ng-model="roleName" bg-blur="checkRole(roleName)">
var isCheck = false;
function checkName(roleName) {
$http({
url: "http://...",
type: "post"
}).then(function(res){
isCheck = res.data[0] == 0 ? true : false;
}, function(err){
//
}).then(
return isCheck;
);
}
$scope.checkRole = function (roleName) {
if(checkName(roleName)) {
///
}
}
Why is it judged to be undefined
in the if (checkName (roleName))
condition, and find the reason?