{"id":15679926,"url":"https://github.com/jameshenry/angular-google-recaptcha","last_synced_at":"2025-05-07T10:29:51.334Z","repository":{"id":57178482,"uuid":"110886684","full_name":"JamesHenry/angular-google-recaptcha","owner":"JamesHenry","description":":sparkles: Easily use Google's reCAPTCHA within your Angular forms","archived":false,"fork":false,"pushed_at":"2018-03-27T15:08:07.000Z","size":68,"stargazers_count":11,"open_issues_count":5,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T19:09:29.967Z","etag":null,"topics":["angular","form","forms","google","recaptcha","typescript"],"latest_commit_sha":null,"homepage":"https://jameshenry.blog","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JamesHenry.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-15T21:08:37.000Z","updated_at":"2023-10-27T12:34:11.000Z","dependencies_parsed_at":"2022-09-09T19:00:14.116Z","dependency_job_id":null,"html_url":"https://github.com/JamesHenry/angular-google-recaptcha","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesHenry%2Fangular-google-recaptcha","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesHenry%2Fangular-google-recaptcha/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesHenry%2Fangular-google-recaptcha/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesHenry%2Fangular-google-recaptcha/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JamesHenry","download_url":"https://codeload.github.com/JamesHenry/angular-google-recaptcha/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249794786,"owners_count":21326774,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","form","forms","google","recaptcha","typescript"],"created_at":"2024-10-03T16:39:12.053Z","updated_at":"2025-04-19T20:31:12.149Z","avatar_url":"https://github.com/JamesHenry.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eAngular Google reCAPTCHA\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://travis-ci.org/JamesHenry/angular-google-recaptcha\"\u003e\u003cimg src=\"https://img.shields.io/travis/JamesHenry/angular-google-recaptcha.svg?style=flat-square\" alt=\"Travis\"/\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/JamesHenry/angular-google-recaptcha/blob/master/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/npm/l/angular-google-recaptcha.svg?style=flat-square\" alt=\"GitHub license\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://www.npmjs.com/package/angular-google-recaptcha\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/angular-google-recaptcha.svg?style=flat-square\" alt=\"NPM Version\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://www.npmjs.com/package/angular-google-recaptcha\"\u003e\u003cimg src=\"https://img.shields.io/npm/dt/angular-google-recaptcha.svg?style=flat-square\" alt=\"NPM Downloads\" /\u003e\u003c/a\u003e\n    \u003ca href=\"http://commitizen.github.io/cz-cli/\"\u003e\u003cimg src=\"https://img.shields.io/badge/commitizen-friendly-brightgreen.svg\" alt=\"Commitizen friendly\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/semantic-release/semantic-release\"\u003e\u003cimg src=\"https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square\" alt=\"semantic-release\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cbr\u003e\n\u003cp align=\"center\" style=\"border: 1px solid blue;\"\u003e\n\u003ca href=\"http://typescriptcourses.com\" target=\"_blank\"\u003e\u003cimg src=\"https://james-henry-cdn.firebaseapp.com/images/typescriptcourses-github-banner.png\" alt=\"typescriptcourses.com\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003cbr\u003e\n\nGoogle's reCAPTCHA is an awesome, UX-friendly way of ensuring that the users who are submitting your forms are actually humans.\n\nAngular has fantastic built in forms functionality which makes it easy to write powerful custom components and validation logic.\n\nThis library makes it effortless to combine them!\n\nIf you ever need to reference the full reCAPTCHA docs you can find them here: [reCAPTCHA docs](https://developers.google.com/recaptcha/)\n\n# Installation\n\nHead over to the command line and use your favourite package manager to install and save it as a dependency:\n\nE.g.\n\n```bash\nnpm install --save angular-google-recaptcha\n```\n\nor\n\n```bash\nyarn add angular-google-recaptcha\n```\n\n# Usage\n\n### 1. If you haven't yet registered your site for use with reCAPTCHA, you'll need to do that next.\n\nHead over to:\n\n[https://www.google.com/recaptcha/admin#list](https://www.google.com/recaptcha/admin#list)\n\n...and register your site.\n\nOnce you have done that, a **\"site key\"** will have been generated for you. You need to find this and copy it to you clipboard as it will be important in the next step!\n\n### 2. Now all you need to do is pass that site key into the library, and this is done via the `forRoot` convention on the `NgModule` which the library exposes.\n\nE.g.\n\n```ts\nimport { BrowserModule } from '@angular/platform-browser';\nimport { NgModule } from '@angular/core';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { RecaptchaModule } from 'angular-google-recaptcha';\n\n@NgModule({\n    imports: [\n        BrowserModule,\n        ReactiveFormsModule,\n        RecaptchaModule.forRoot({\n            siteKey: 'YOUR_SITE_KEY_HERE',\n        }),\n    ],\n    bootstrap: [AppComponent]\n})\nexport class AppModule { }\n```\n\nAs you might expect, you need to be using the `@angular/forms` package (either the `FormsModule` or `ReactiveFormsModule`) within your project, otherwise this library will have nothing to hook into.\n\n### 3. With everything wired up, you can now use the `\u003crecaptcha\u003e` component!\n\nE.g. For reactive forms\n\n```ts\nimport { Component } from '@angular/core';\nimport { FormControl } from '@angular/forms';\n\n@Component({\n    selector: 'app',\n    template: `\n        \u003crecaptcha\n          [formControl]=\"myRecaptcha\"\n          (scriptLoad)=\"onScriptLoad()\"\n          (scriptError)=\"onScriptError()\"\n        \u003e\u003c/recaptcha\u003e\n    `\n})\nexport class AppComponent {\n    myRecaptcha = new FormControl(false);\n\n    onScriptLoad() {\n        console.log('Google reCAPTCHA loaded and is ready for use!')\n    }\n\n    onScriptError() {\n        console.log('Something went long when loading the Google reCAPTCHA')\n    }\n}\n```\n\nE.g. For template-driven forms\n\n```ts\nimport { Component } from '@angular/core';\n\n@Component({\n    selector: 'app',\n    template: `\n        \u003crecaptcha\n          [(ngModel)]=\"myRecaptcha\"\n          (scriptLoad)=\"onScriptLoad()\"\n          (scriptError)=\"onScriptError()\"\n        \u003e\u003c/recaptcha\u003e\n    `\n})\nexport class AppComponent {\n    myRecaptcha: boolean\n\n    onScriptLoad() {\n        console.log('Google reCAPTCHA loaded and is ready for use!')\n    }\n\n    onScriptError() {\n        console.log('Something went long when loading the Google reCAPTCHA')\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjameshenry%2Fangular-google-recaptcha","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjameshenry%2Fangular-google-recaptcha","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjameshenry%2Fangular-google-recaptcha/lists"}