I have many controls on my form. I evaluate some rules for my controls. When the visiblityExpression
for certain control will be evaluated to false I would like make the control not visible.
this.formControl
dervies from AbstractControl
. What method I can call to make it not visible to the user?
I wanted to do something like that: if(result === false) this.formControl.hide();
I think [hidden] directive on top of your form with boolean variable isVisible
should do the trick:
[hidden]="formControl.isVisible"
Plunker Example with hiding textboxes. The same can be apply for whole control. Personally I think it is better to remove control from DOM with *ngIf than just hide it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.