Tags:  javaangular
Source:  Twitter logo
onSubmit(Values from form here?){
 this.http.post("A URL", legacyURL).subscribe();

 } 

According to your question, if my understanding is correct, You want to pass parameters while making post request.

You can do something like this:

const val = this.form.value;

 this.http.post('url', {
      first_name: val.first_name,
      last_name: val.last_name,
      email: val.email,
    })
      .subscribe(response => {

      });
4 users liked answer #0dislike answer #04
yer profile pic
yer

You should use the HttpParams library to add multiple params in your request headers.

import { HttpClient, HttpParams } from '@angular/common/http';

onSubmit(values val){
  let params = new HttpParams()
      .set('username', val.username)
      .set('password', val.password)

  this.http.post("A URL", params).subscribe();

}
1 users liked answer #1dislike answer #11
Kostas Asargiotakis profile pic
Kostas Asargiotakis

Copyright © 2022 QueryThreads

All content on Query Threads is licensed under the Creative Commons Attribution-ShareAlike 3.0 license (CC BY-SA 3.0).