无法从函数中获取值

时间:2021-06-02 12:25:18

标签: javascript angularjs function frontend

像下面一样,我将值传递给函数,但无法从中获取任何值作为回报。我需要 vm.phoneNumberStatus 中的值 尝试从 phone_status 变量

中获取值

这是我绑定的 HTML

<span ng-if="vm.phoneNumberStatus.VerificationStatus=='Valid'"> {{vm.phoneNumberStatus.VerificationStatus}} </span>  


vm.verifyNumber(vm.phoneNumberStatus, vm.CandidateInfo1[0].Phone_Mobile, vm.currentMPhoneStatus)

vm.verifyNumber = function (phone_status, number, currentStatus) {
    return factory.getTableObj('PhoneVerificationDetails', {
        PartitionKey: api.Emp_Id
    })
    .then(function (vfdata) {
        phone_status = vfdata.find(function (s) {
            vm.trimmedNumber = number.replace(/[- )(]/g, '')
            return s.To === vm.trimmedNumber
        });
        currentStatus = phone_status.VerificationStatus;
        if (phone_status.VerificationStatus == 'Pending') {
            vm.startVerifyNumber = $interval(function () {
                $interval.cancel(vm.startVerifyNumber)
                vm.verifyNumber(phone_status, number, currentStatus)
            }, 5000)
        }
        if (phone_status.VerificationStatus != 'Pending') {
            $interval.cancel(vm.startVerifyNumber)
        }
    })
}

0 个答案:

没有答案