Q:

How to transfer data from Angular to Node.js?

I want to build a comment section in my Angular App. These comments are supposed to be stored in a database, so I want to forward the data from Angular to Node.js, where it can be passed on to the database. So I created an input field for comments in detail.component.html. The comment is saved when the user hits enter.  
<input #box (keyup.enter)="update(box.value)">
<p>{{value}}</p>

In detail.component.ts I save the comment in a variable: 
public value: any= []
update(comment: any) { this.value = comment; }
//code
this.dataService.addComment().subscribe(comment => this.value = comment)

Here is the first problem - how do I get the comment to data.service.ts?
//code
addComment() {}

And then there is the actual question: How can I forward this comment to server.js in the node.js App? 
I am quite new to Angular, so I am pretty clueless of how to achive this. I found this question How to pass form data from angular to nodejs samewhat useful, but could not apply it to my usecase. So how can I transfer the data from Angular to Node.js?

A:

If you have already defined API(POST) on the server-side then you just need to call the http.post method like below:
  addComment(title: string) {
    const postData = new FormData();
    postData.append('title', title);
    return this.http
      .post<{ title: string; }>(
        '<HOST_NAME>/api/comments',
        postData
      )
  }

and to use it you have to subscribe it as Observables are lazy as below:
this.dataService.addComment(this.value).subscribe(console.log); 

