1

I have created dummy json array as given below

[ { "firstname": "ramu", "lastname": "mothukuri", "city": "chennai", "street": "sivan koiil street", "pin": "600024" } ]

and i tried to click on button using onMy function available in app.component.ts. but the same json array i am getting when i am checking in console. please check i have attached screen-shot.

Below is my CODE URL CODE URL

enter image description here

2 Answers 2

1

You are console loggin users, whereas you want to actually console log the form values:

<form [formGroup]="myForm" (ngSubmit)="onMy(myForm.value)">

TS:

onMy(form){
  console.log(form);
}

Your StackBlitz

Sign up to request clarification or add additional context in comments.

1 Comment

Great, glad to hear :)
0
console.log(this.myForm.controls.users.controls[0].controls.firstname.value);
console.log(this.myForm.controls.users.controls[0].controls.lastname.value);

Using formcontrol, get the needed latest response!!!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.