I am trying to understand how to call Http.post method in Angular. I am trying to build a form with certain input fields. As soon as the user would hit the submit button on the UI, it will call a services ( written in springboot) to insert records into a database. Though my springboot services is running fine but I am not able to call it properly from Angular.

**services.ts:**

```
 export class MFinService {

  constructor(private http: HttpClient ) { }

  public addRecord(networth : any){
    return this.http.post<any>("http://localhost:8080/networth" , networth);

  }
}

```

**component.ts :**

```
export class NetworthHomeComponent implements OnInit {

  constructor(private mFinService : MFinService) { }

  ngOnInit(): void {
  }

  // Reactive cardForm
  cardForm = new FormGroup({
      account : new FormControl(),
      ppf : new FormControl(),
      nps : new FormControl(),
      pf : new FormControl(),
      stocks : new FormControl(),
      mf : new FormControl(),
      online : new FormControl()
  });

  public submitForm(){
    console.log(this.cardForm.value);

    this.mFinService.addRecord(this.cardForm.value).subscribe(
      (data : any) => {
        console.log(data);
      }
    )
  }

}

```

**Springboot controller class :**

```
@PostMapping("/networth")
    public ResponseEntity<String> addNetworth(@RequestBody Networth networth){
        int result = mFServices.addNetDetails(networth);
        if(result > 0){
            return ResponseEntity.status(HttpStatus.OK).body("A new records has been inserted !");
        }

        return null;
    }

```

**Springboot DTO class :**

[![enter image description here](https://i.stack.imgur.com/y5IAK.png)](https://i.stack.imgur.com/y5IAK.png)

Error :

[![enter image description here](https://i.stack.imgur.com/ppgBE.png)](https://i.stack.imgur.com/ppgBE.png)

**inserted records in database :**

[![enter image description here](https://i.stack.imgur.com/vxmJj.png)](https://i.stack.imgur.com/vxmJj.png)

**Request and Response from the Network tab :**

[![enter image description here](https://i.stack.imgur.com/u6XYG.png)](https://i.stack.imgur.com/u6XYG.png)

[![enter image description here](https://i.stack.imgur.com/PgE4Y.png)](https://i.stack.imgur.com/PgE4Y.png)