Package Exports
- ng-skpf-recaptcha
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ng-skpf-recaptcha) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Angular site-key providing free service for Google reCAPTCHA (Based on ng-recaptcha by @DethAriel)
ng-skpf-recaptcha 
A simple, configurable, easy-to-start service for handling reCAPTCHA v3.
Table of contents
Installation
The easiest way is to install through npm:
npm i ng-skpf-recaptcha --savereCAPTCHA v3 Usage
import { BrowserModule } from '@angular/platform-browser';
import { ReCaptchaV3Service } from 'ng-recaptcha';
import { MyApp } from './app.component.ts';
@NgModule({
bootstrap: [MyApp],
declarations: [MyApp],
imports: [
BrowserModule
],
providers: [
ReCaptchaV3Service
]
})
export class MyAppModule { }
In order to execute a reCAPTCHA v3 action, import the ReCaptchaV3Service into your desired component:
import { ReCaptchaV3Service } from 'ng-recaptcha';
@Component({
selector: 'recaptcha-demo',
template: `
<button (click)="executeImportantAction()">Important action</button>
`,
})
export class RecaptchaV3DemoComponent {
constructor(
private recaptchaV3Service: ReCaptchaV3Service,
) {
// set site-key
this.recaptchaV3Service.siteKey.next('<RECAPTCHA_V3_SITE_KEY>');
}
public executeImportantAction(): void {
this.recaptchaV3Service.execute('importantAction')
.subscribe((token) => this.handleToken(token));
}As always with subscriptions, please don't forget to unsubscribe.