Since the onload callback function on the API script's URL should be the callback in the service (vcRecapthaApiLoaded), it would be nice to allow for other callbacks so the dev can know when its been called. There should be a way to have a callback function called when recaptcha is loaded and angular-recaptcha is ready.
var app = angular.module('myModule', ['vcRecaptcha']);
app.config(['vcRecaptchaServiceProvider', function(vcRecaptchaServiceProvider) {
vcRecaptchaServiceProvider.onLoad.push(function(recaptcha){
// recaptcha is loaded, do something
});
}]);
Here, onLoad is an array of functions, when the vcRecapthaApiLoaded callback is called, it would call the onLoad functions.
Current work-around:
Set the API script URL's onload callback to your custom function (with the logic you need) then manually call vcRecapthaApiLoaded from your function to notify angular-recaptcha that recaptcha is loaded.
Since the
onload
callback function on the API script's URL should be the callback in the service (vcRecapthaApiLoaded
), it would be nice to allow for other callbacks so the dev can know when its been called. There should be a way to have a callback function called when recaptcha is loaded and angular-recaptcha is ready.Here,
onLoad
is an array of functions, when thevcRecapthaApiLoaded
callback is called, it would call theonLoad
functions.Current work-around: Set the API script URL's
onload
callback to your custom function (with the logic you need) then manually callvcRecapthaApiLoaded
from your function to notify angular-recaptcha that recaptcha is loaded.