Observable automatically completes after emission for example of(1), observer=> observer.next(1) hence for observable, usally piple(fianlize()) can always be used. Note finalize is always called in the end when observable completes.
For subject, it does not complete after next, subject.next(1), subject.next(2), it can keep emitting, for subject to complete use
var complete = subject.piple(take(1))
https://stackoverflow.com/questions/49735826/rxjs5-finalize-operator-not-called
For some observable, it may not always be completed after emission such as this.route.queryParams,
Need to call this.route.queryParams.pipe(take(1)),
https://stackoverflow.com/questions/49735826/rxjs5-finalize-operator-not-called
No comments:
Post a Comment