> For the complete documentation index, see [llms.txt](https://msk-satheesh-5599.gitbook.io/ng-mat-forms/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://msk-satheesh-5599.gitbook.io/ng-mat-forms/apis/setformvalue.md).

# setFormValue

### Description

* set an value for the formGroup
* parameters
  * form value object contains formControlName as key and value
    * example: { name: 'msk' }

### Example

```typescript
import { NgMatFormOptions, NgMatFormFields, NgMatFormService } from 'ng-mat-forms';
// other imports here...

export class MyTestApp {

    public ngMatFormsOptions: NgMatFormOptions = {
        column: 3
        // other options...
    };

    // Initialized a field list array which extended a field interface.
    public ngMatFormFields: NgMatFormFields[] = [{
        type: 'input',
        label: 'User Name',
        placeholder: 'Enter a User Name',
        formControlName: 'name'
        // other options...
    }];
    
    setValue(): void {
        //this.ngMatFormService.setFormValue({ [formControlName]: 'msk' });
        this.ngMatFormService.setFormValue({ name: 'msk' });
    }

    constructor(private ngMatFormService:NgMatFormService) {}
}
```

```
```
