0

I tried to push first object only into array but it's adding all the objects. I have attached the screen shot. I have three fields first is firstname and last name street. I need to show only first object value. but it's showing all the data. How to display first one object, it having multiple objectives also? Below is the CODE URL

https://stackblitz.com/edit/angular-formgroup2-first?file=app%2Fapp.component.ts

1 Answer 1

1

Get rid of the mapper, and only push first element

   let formArr = <FormArray>this.myForm.controls.users;
      formArr.push(fb.group({
        firstname: this.users[0].firstname,
        lastname: this.users[0].lastname,
        street: this.users[0].street
      }))
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.