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

gemini cli getting file not defined error

NodeJS: Error: spawn EINVAL in window for node version 20.20 and 18.20

vllm : Failed to infer device type