angular-recaptcha
angular-recaptcha copied to clipboard
Error after form submission
Using the following directive I'm able to successfully use Recaptcha:
<div vc-recaptcha ng-model="fields[RECAPTCHA_FIELD]" key="RECAPTCHA_PUBLIC_KEY"></div>
RECAPTCHA_FIELD and RECAPTCHA_PUBLIC_KEY are both in my $scope.
But after submitting the form (which includes a valid recaptcha token that I validate server side), I see the following error in my JS console:
Error: You need to set the "key" attribute to your public reCaptcha key. If you don't have a key, please get one from https://www.google.com/recaptcha/admin/create
This doesn't happen when I hardcode the key. Also doesn't happen when those variables are in the $rootScope.
Sounds like the key, when in the local scope is removed from the scope after the form is submitted. Can you post your controller and any relevant code or recreate this in a plunkr or fiddle?