4

I'm trying to show and hide a form field using Angular's *ngIf but, when I do, the entire form doesn't render no matter the value I give the *ngIf and no errors are thrown. Clearly the *ngIf isn't the way to go. Is there a more DevExtreme way to do this? I see there is a visible in the documentation but I don't just want to hide it.

HTML

<dx-form id="companyDetailsForm" [(formData)]="company" [showColonAfterLabel]="false">
  <dxi-item dataField="Name">
    <dxi-validation-rule type="required" message="Name is required"></dxi-validation-rule>
  </dxi-item>
  <dxi-item *ngIf="hasParent" dataField="Parent" caption="Parent">
    <dxo-label text="Parent"></dxo-label>
  </dxi-item>
</dx-form>
Aaron Salazar
  • 4,467
  • 10
  • 39
  • 54
  • Why is there a `*` before your `ngIf`? The form I'm used to is just `ngIf`. – Justin Burgard Mar 30 '17 at 19:32
  • 1
    @JustinBurgard, check out this link for information about the `*` I'm using. http://stackoverflow.com/questions/40078189/angular-2-why-asterisk – Aaron Salazar Mar 30 '17 at 19:37
  • I am sure you must have checked this.. but I hope you are checking the value hasParent and making sure it's not causing the issue. – Shoban Mar 30 '17 at 21:02

1 Answers1

1

Use visible property instead, *ngIf does not work in the DX Form.

<dxi-item [visible]="hasParent"