An AngularJS module to ease usage of new Google reCaptcha inside a form

Module License: MIT

Added by: Sam Deering





Stars: 2

Watchers: 2

Forks: 0

Module Description

G reCaptcha AngularJS Directive

Use this directive to be able to submit with XHR a form that contains a NEW Google reCaptcha.

Allow you to use multiple recaptcha widgets on one page.


See the demo file for an usage example.

Keep in mind that the captcha only works when used from a real domain and with a valid re-captcha key, so this file wont work if you just load it in your browser.


First, you need to get a valid public key for your domain. See

Then, include the reCaptcha AJAX API using this script in your HTML:

<script type="text/javascript"  src=""></script>

Also include the g-recaptcha script and make your angular app depend on the vcRecaptcha module.

    <script src="angular-g-recaptcha.js"></script>
var app = angular.module('myApp', ['angularGRecaptcha']);

After that, you can place a container for the captcha widget in your view, and call the vc-recaptcha directive on it like this:

<div g-recaptcha id="captcha_img" ng-model="model.response" theme="clean" key="model.key"></div>

Here the key attribute is passed to the directive's scope, so you can use either a property in your scope or just a hardcoded string. Be careful to use your public key, not your private one.

Validation on server:

ng-model should contain model for value used in verifying the user's response e.g: ng-model="model.response"


  • Any g-recaptcha directive should have id attribute
  • You have to bootstrap your angular application after recaptcha js loaded. So in example we have onload callback for recaptcha/api.js with simple code:
var initApp = function(){
    angular.element(document).ready(function () {
        angular.bootstrap(document, ["testApp"]);

Other Parameters

You can optionally pass other parameters to the captcha, as html attributes:

        key="'---- YOUR PUBLIC KEY GOES HERE ----'"

In this case we are specifying that the captcha should use the theme named 'clean'.

Module stats last updated: 2015-06-04 11:08:53

Disclaimer: Some data on this page may have been gathered from the authors GitHub respository. If you see any mistakes or outdated information please let us know. Thanks!