Search Posts

TypeError: Cannot read property ‘value’ of null in angular js

I am using google recaptcha before a form submit in my angular js application and it is working fine for the first time but if i try to submit the form second time(same form) it is showing the error
angular.js:14525 TypeError: Cannot read property 'value' of null

My recaptcha code is

<div vc-recaptcha key="my key here" ng-model="letter.myRecaptchaResponse" on-create="setRecaptchaId(widgetId)"> </div> 

My controller code is

$scope.setRecaptchaId = function(widgetId) {
    $scope.recaptchaId = widgetId;
    return;
};
$scope.letter.mresponse = vcRecaptchaService.getResponse($scope.recaptchaId);

Actually if i refresh the form after first submit everything is working fine, feeling strange about it. I took suggestions from this click here but nothing solved my issue.

Source: AngularJS

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.