angular 8 post request with parameters code example
Example 1: angular http POST params boolean
body.set('paramStringName', booleanValueYouWantToPass.toString());
Example 2: angular post request
ngOnInit() {
this.http.post<any>('https://reqres.in/invalid-url', { title: 'Angular POST Request Example' }).subscribe({
next: data => {
this.postId = data.id;
},
error: error => {
this.errorMessage = error.message;
console.error('There was an error!', error);
}
})
}
...
interface Article {
id: number;
title: string;
}