I am using anuglar-recaptcha for adding Google Invisible Recaptcha to my login form
The issue I am facing is, immediately after I call vcRecaptchaService.execute, if I print the recaptcha_reponse I will see undefined as output. But if I print recaptcha_reponse few seconds afterwards by using a test function printRecaptchaReponse I will see the recaptcha_reponse getting printed.
The Issue here is, the library function vcRecaptchaService.execute() is not returning a $promise here. Its actually returning none
Is there any way to promisify this ?
Whats the ISSUE:
// 1. Call this function from html first $scope.testRecaptchaExecute = function() { vcRecaptchaService.execute($scope.widgetId); console.log($scope.user.recaptcha_reponse); // undefined return(); }// 2. Call this function from html few seconds after testRecaptchaExecute() is called $scope.printRecaptchaReponse = function() { console.log($scope.user.recaptcha_reponse); //JVRk4cZ4J_RluoH2 }
WHAT I want:vcRecaptchaService.execute().then(ret => { //do something here })
Question Summary
How to use .then method for vcRecaptchaService.execute()?
I am using anuglar-recaptcha for adding Google Invisible Recaptcha to my login form
The issue I am facing is, immediately after I call vcRecaptchaService.execute, if I print the
recaptcha_reponse
I will seeundefined
as output. But if I printrecaptcha_reponse
few seconds afterwards by using a test functionprintRecaptchaReponse
I will see therecaptcha_reponse
getting printed.The Issue here is, the library function
vcRecaptchaService.execute()
is not returning a$promise
here. Its actually returningnone
Is there any way to promisify this ?
Whats the ISSUE:
// 1. Call this function from html first
$scope.testRecaptchaExecute = function() { vcRecaptchaService.execute($scope.widgetId); console.log($scope.user.recaptcha_reponse); // undefined return(); }
// 2. Call this function from html few seconds after testRecaptchaExecute() is called
$scope.printRecaptchaReponse = function() { console.log($scope.user.recaptcha_reponse); //JVRk4cZ4J_RluoH2 }
WHAT I want:
vcRecaptchaService.execute().then(ret => { //do something here })
Question Summary How to use
.then
method forvcRecaptchaService.execute()
?