angular method post code example
Example: 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;
}