When using web services, when is the best time to unsubscribe? In my code I have been doing this
tempFunction() {
    const temp = this.myService.getById(id).subscribe(
        response => this.model = response,
        error => console.error(error),
        final => temp.unsubscribe() // unsubscribe here
    );
}
But everywhere else, I have seen this
temp: any;
tempFunction() {
    temp = this.myService.getById(id).subscribe(
        response => this.model = response,
        error => console.error(error),
        final => {}
    );
}
ngOnDestroy() {
    this.temp.unsubscribe(); // vs unsubscribe here
}
Is there a functional difference in how I am unsubscribing vs how everyone else is unsubscribing?
 
     
     
    