-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix(formController): do not let removed control effect form #9037
Conversation
forEach(ctrl[key], function(value, validationErrorKey) { | ||
ctrl.$$getParentForm().$setValidity(validationErrorKey, combinedState, ctrl); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shahata: I don't expect it to have a significant impact, but wouldn't it be better to "cache" the parentForm
outside the forEach
loops:
var formCtrl = ctrl.$$getParentForm();
forEach(stateMap, function(combinedState, key) {
forEach(ctrl[key], function(value, validationErrorKey) {
formCtrl.$setValidity(validationErrorKey, combinedState, ctrl);
});
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, thanks
02dc2aa
to
fd2d6c0
Compare
@tbosch can you take a look? |
@@ -58,6 +58,61 @@ describe('form', function() { | |||
expect(form.alias).toBeUndefined(); | |||
}); | |||
|
|||
it('should not be effected by input controls that were removed from the form', function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
affected
@btford fixed + rebased |
abdaab7
to
30996f8
Compare
We decided to that this was an invalid use of the @btford I believe we should close this unless you have some pending task related to this PR. |
Hmmm, I thought that this change might be particularly useful if we decide to support the |
Interesting, didn't know this. Let's revisit this PR when we work on #8917.... |
This PR fixes some issues with manually removing and adding controls from forms:
Closes #9035