Reputation: 23120
What's the difference between unsubscribe and disposing ?
e.g.
// app-service.ts
{Http} from @angular/core;
export class appService {
constructor(private http : Http, fooService : FooService) {}
getAll() {
// do this
this.sub = this.fooService.subscribe(
() => {},
error => throw new Error(error),
() => {}
)
}
ngOnDestroy() {
this.sub.dispose();
}
}
Upvotes: 1
Views: 251
Reputation: 40647
It is a rxjs4
- rxjs5
difference;
In rxjs4
there were Disposable
s that you dispose()
, now they are Subscription
s that you unsubscribe()
Source: https://github.com/ReactiveX/rxjs/blob/master/MIGRATION.md
Upvotes: 6