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

153
Views
how to set value to form control array of objects

In a formgroup we can patch or set value to control name like the ff this.modelForm.get('data1').patchValue('sample data') , but what if the structure is an array of objects below like .

How do I set value or patch value to testData which is inside data1? . Thanks.

  "data1": [
            {
                "testData": "2022-04-01T00:00:00",
       
            }
        ]

.....
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Simply as that


myControl.setValue([...myControl.value, 'new value']);

about 4 years ago · Juan Pablo Isaza Report

0

you need to access that array and append to the array, like this.

this.modelForm.get('data1').push('add data here').

this will automatically take the new data and append it in the formControl.

about 4 years ago · Juan Pablo Isaza Report
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!