From 1024fd4aa9fbe90623ac7612b0af74fd4a491d90 Mon Sep 17 00:00:00 2001 From: Rumit Parakhiya Date: Fri, 19 Aug 2016 19:48:38 +0530 Subject: [PATCH] Fix: Call to reset() method fails when form contains radio buttons Checked existence of the property in `scope[formElement.Name]` too, before calling `$setViewValue("")` on it --- src/angular-validator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/angular-validator.js b/src/angular-validator.js index 6445d85..f2cdf32 100644 --- a/src/angular-validator.js +++ b/src/angular-validator.js @@ -82,7 +82,7 @@ angular.module('angularValidator').directive('angularValidator', ['$injector', ' // Clear all the form values. Set everything to pristine. scopeForm.reset = function() { angular.forEach(DOMForm, function(formElement) { - if (formElement.name) { + if (formElement.name && scopeForm[formElement.name]) { scopeForm[formElement.name].$setViewValue(""); scopeForm[formElement.name].$render(); }