重置Angular应用中的Google Recaptcha?

Geo*_*ora 1 javascript recaptcha angularjs

我在一个有角度的项目中使用Google的Recaptcha,它按预期工作,但我不知道如何重置它。

我有一个表单,用户可以在其中发送数据,我希望在表单成功发布后重置表单,以便用户可以发送另一封邮件。

在我的控制器中,我有以下方法:

 var resetForm = function () {
   //reset my models
   //reset my flags

   //here I would like to reset the recaptcha

}
Run Code Online (Sandbox Code Playgroud)

如何通过角度控制器内部的功能执行此操作?

bru*_*rce 5

如果您使用的是版本1

Recaptcha.reload();
Run Code Online (Sandbox Code Playgroud)

如果您使用的是版本2

grecaptcha.reset();
Run Code Online (Sandbox Code Playgroud)

通过选择器:

jQuery('#recaptcha_reload').click();
Run Code Online (Sandbox Code Playgroud)