Skip to content

Commit 1d5f3f1

Browse files
author
Tuomo Jokimies
committed
Use grecaptcha from window
1 parent 5a69e37 commit 1d5f3f1

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/angular-no-captcha.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ angular
4545
'noCAPTCHA',
4646
'googleGrecaptcha',
4747
'$document',
48-
function (noCaptcha, googleGrecaptcha, $document){
48+
'$window',
49+
function (noCaptcha, googleGrecaptcha, $document, $window){
4950
/**
5051
* Removes all .pls-container elements
5152
*
@@ -107,19 +108,19 @@ angular
107108
}
108109

109110
googleGrecaptcha.then(function (){
110-
widgetId = grecaptcha.render(
111+
widgetId = $window.grecaptcha.render(
111112
element[0],
112113
grecaptchaCreateParameters
113114
);
114115
control.reset = function (){
115-
grecaptcha.reset(widgetId);
116+
$window.grecaptcha.reset(widgetId);
116117
scope.gRecaptchaResponse = null;
117118
};
118119
});
119120

120121
scope.$on('$destroy', function (){
121-
if(grecaptcha) {
122-
grecaptcha.reset(widgetId);
122+
if($window.grecaptcha) {
123+
$window.grecaptcha.reset(widgetId);
123124
}
124125
removePLSContainers();
125126
});

0 commit comments

Comments
 (0)