Skip to content

Commit

Permalink
Fix: Call to reset() method fails when form contains radio buttons
Browse files Browse the repository at this point in the history
Checked existence of the property in `scope[formElement.Name]` too, before calling `$setViewValue("")` on it
  • Loading branch information
Rumit Parakhiya authored Aug 19, 2016
1 parent 9b1b176 commit 1024fd4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/angular-validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 1024fd4

Please sign in to comment.