To Home

Documentation

Default Inputs Custom Inputs Nested Inputs Retrieving Form Data Styling

Retrieving Form Data

You can access the data inserted in the form with.

class AppComponent {
    /* ... */
    @ViewChild(DynamicFormsComponent) dynamicForm: DynamicFormsComponent;
    
    ngAfterViewInit(): void {
    
        let formResult = this.dynamicForm.getResult();
    
    }
}

The result is a json with field names equals to the annotated field. Filled with the form values.

let formResult = {
  name: 'Bob',
  password: 'verysecurepassword',
  email: ''  
}