I was wondering what is the best way to unsubscribe a post / put / patch / delete on the HTTP service
for example, given this method, called in a page to save an object:
public add(obj) {
const sub = this.service.post('/path/to/resource', obj).subscribe(()=>{
console.log('saved');
sub.unsubscribe();
});
}
Do I need to unsubscribe it and did I correctly unsubscribed it?
Updated: Please note that this add method will be called multiple times!
Update 2: Yes it is an HttpClient service