http client post request body angular code example
Example 1: 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;
})
}
Example 2: angularjs make post request
var url = 'posturl', data = 'parameters',config='contenttype';
$http.post(url, data, config).then(function (response) {
// This function handles success
}, function (response) {
// this function handles error
});