File tree Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -64,21 +64,30 @@ It provides `RecaptchaService`.
64642 . ` RecaptchaRender.Onload ` renders the first element with ` g-recaptcha ` class.
65653 . ` your_sitekey ` renders isolated invisible reCAPTCHA that can be used from ` RecaptchaService ` . V3 best practice.
6666
67- ` onload ` : specifies function name on the window object.
67+ ` onload ` : specifies a function name on the window object. Defaults to ` RecaptchaOnloadEventName = 'recaptchaloaded' `
6868
69- ` onloadFunc ` : specifies function that is executed after reCAPTCHA loads.
69+ ` onloadFunc ` : specifies a function that is executed after reCAPTCHA loads.
7070
7171` recaptchaUrl ` : script's url. Defaults to ` RecaptchaGoogleUrl = 'https://www.google.com/recaptcha/api.js' `
7272
7373``` ts
74+ export async function onLoad(recaptcha : Recaptcha ) {
75+ // Sitekey Execution
76+ const result = await recaptcha .execute (' your_sitekey' , { action: ' background' })
77+ console .log (result )
78+ }
79+
80+ @NgModule ({
81+ imports: [
82+ // ...
7483 RecaptchaLoaderModule .withParameters ({
7584 language: ' en' ,
7685 render: ' your_sitekey' ,
77- onloadFunc: async aptcha : Recaptcha ) => {
78- // Sitekey Execution
79- const result = await recaptcha . execute ( ' your_sitekey ' , { action: ' background ' })
80- } ,
81- }),
86+ onloadFunc: onLoad
87+ }), // loads script and allows to use `RecaptchaService`
88+ // ...
89+ ] ,
90+ })
8291```
8392
8493### RecaptchaService
You can’t perform that action at this time.
0 commit comments