How to get value of disabled control in angular material

Viewed 52

I have divided my form into multiple components. Only parent component has form control. Child components has for "formGroup" attribute.

On submit I need to read values of all controls but child component has few controls disabled.

I tried value and getRawValue options but both giving the same result.

let fullForm: myClass;
this.parentForm=this.formBuilder.group({
  childGroup1:[this.fullForm.child1]
  childGroup2:[this.fullForm.child2]
});

submit(){
--Both below line of code is not giving disabled controls value from child component
  console.log(this.parentForm.value);
  console.log(this.parentForm.getRawValue());
}
---Parent component html---
<form [formGroup]="parentForm">
<add-child1 [formGroup]="childGroup1"></app-child1>
<add-child2 [formGroup]="childGroup2"></app-child2>
<button (click)="submit()"></button>
</form>

I have used ControlValueAccessor in child components.

0 Answers
Related