angular.module("MainApp").directive("gRecaptcha", function(){ return { restrict: 'C', link: function($scope, $element, attr){ setTimeout(function(){ grecaptcha.render($element[0], { 'sitekey' : '6Ldp8gUTAAAAAEMEYOLBMSVJxYHwYv8gdOKZoLS4', 'callback' : function(response) { window.grecaptchaValue = response; } }); }, 1000); } }; });