I have in my code:
private buildFormGroup() {
const internalFormGroup = this.formBuilder.group({
document: ['', [Validators.required, Validators.min(this.minValueDocument)]],
company: ['', [Validators.required]],
typeClient: ['', [Validators.required]],
textRequest: ['', [Validators.required, Validators.minLength(this.minNumberCharPerRequest)]],
files: [''],
myKey: ['myValue'],
});
return internalFormGroup;
}
In my constructor I have this lines following this answer:
this.formGroup = this.buildFormGroup();
for(let item in Object.keys(this.formGroup.controls)) {
console.log(item)
}
for(let item in this.formGroup.controls) {
console.log(this.formGroup.controls[item])
}
But, I get only numbers and the value
appears empty!!!
I forget something? How I can get the name
of the control (not the its Value
)?
For my previous example: I would like to get: document, company, typeClient, textRequest,files, myKey