Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

612
Views
setValue() and patchValue() method is not working in Angular

I'm developing a contact change form for my application using FormGroup and FormControl with Angular 8. I set up several fields that are filled in advance if the information is already filled in for the contact. So I used this method several times to be able to set up the fields of my form: create several FormControls, push them into a FormControl array which will then be placed in a FormGroup. Everything works well except for one, the value always remains a null, even the method setValue() and patchValue() does not work.

Method used in general for all fields:

const controls = {};                
let control = new FormControl({
    value: fieldToValue(this.values, field.key, field, true),
    disabled: this.locked
});
controls[this.prefix + field.key] = control;
this.group = new FormGroup(controls); 

I tried this too but it doesn't work:

let value = '2';
control = new FormControl();
control.setValue(value);

result

Do you know what is preventing my FormControl from setting its value ?

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!