httpCLient post with headers angular code example
Example 1: how to set header in angular 8post
let headers = new HttpHeaders({
'Content-Type': 'application/json',
'Authorization': this.basic });
let options = { headers: headers };
Example 2: angular httpclient post body
ngOnInit() {
this.http.post<any>('https://jsonplaceholder.typicode.com/posts', { title: 'Angular POST Request Example' }).subscribe(data => {
this.postId = data.id;
})
}