v8 - use ng-hide in validation directive #9028
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prerequisites
Description
This is a left-over bit from work on #8894. In fiddling with that issue, I found that the showValidationOnSubmit directive used
.show()
and.hide()
to control element visibility. That's all good until we want to change the visibility of the validation messages using theng-show
orng-hide
directive in a view..show()
and.hide()
set an inline style attribute, which has higher specificity than the class added byng-show
orng-hide
so it's not possible to control the element visibility outside the events in validation directive.To fix that, I've removed
.show()
and.hide()
in favour of toggling theng-hide
class name on the outermost element. End result is the same (display property is set to `none!important' but it's done via a class rather than the style attribute, so isn't insanely specific. Also means that we're not mixing jQuery with Angular, which can (this PR as an example) cause unexpected behaviour.