Angular Form - Item Properties

To change an item property at runtime, bind the property that should be changed to a component property:

HTML
TypeScript
  • <dx-form
  • [(formData)]="employee">
  • <dxi-form-item dataField="firstName"></dxi-form-item>
  • <dxi-form-item dataField="lastName"></dxi-form-item>
  • <dxi-form-item itemType="group" caption="Contacts">
  • <dxi-form-item dataField="phone" [visible]="showPhone.value"></dxi-form-item>
  • <dxi-form-item dataField="email"></dxi-form-item>
  • </dxi-form-item>
  • </dx-form>
  • <dx-check-box #showPhone
  • text="Show the Phone Number"
  • [value]="true">
  • </dx-check-box>
  • import { DxFormModule, DxCheckBoxModule } from "devextreme-angular";
  • // ...
  • export class AppComponent {
  • employee = {
  • firstName: "John",
  • lastName: "Heart",
  • phone: "+1(213) 555-9392",
  • email: "jheart@dx-email.com"
  • }
  • }
  • @NgModule({
  • imports: [
  • // ...
  • DxFormModule,
  • DxCheckBoxModule
  • ],
  • // ...
  • })

When you modify an item, the Form also refreshes all other items in its group. If an item is not in a group, the whole Form is refreshed. To update only your chosen items, wrap them into a separate group.

NOTE
When you call this method, Form rerenders the layout. As a result, all editors are re-initialized and their settings return to the initial editorOptions configuration.
See Also