Reputation: 377
I've got a really long form and want to show pieces of the form based on what section the user clicked. I don't want to use *ngIf because it removes elements from the Dom and have a form validator that needs to read the entire template whole.
Right now I am hiding divs using this <div class="row social-media"
[hidden]="navToggleIndex!=1">
but when I switch to a new section, the spacing of rows is still there. So I get blank space until the next set of visible divs/rows. How can I also hide the spacing? *ngIf removes spacing but causes the problem above.
Upvotes: 1
Views: 1442
Reputation:
You may try
<div class="row social-media" [ngClass]="{ 'hide': navToggleIndex!=1 }">
And I'm not sure which validation library you currently used. But If it's jQuery Validator, you must put this options.
$.validator.setDefaults({
ignore: []
});
To prevent jQuery Validator ignores hidden elements.
Upvotes: 2