angular2 http post with subscribe and catch



Why don't we use catch when calling http post construct? For example,





this.http.post(APPLICATION_HOST + '/employee/save', payload, {headers : headersJson})
.catch(err => {
console.log(err);
}



Http Post is lazily instantiated with subscribe method call. That's why the code below is better :-





Comments

Popular posts from this blog

ionic2 cordova build android - Unable resolve gradle 2.2.3

A quick tutorial for OWASP ZAP tool for beginners

OpenCover code coverage for .Net Core