Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

615
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda