javascript - Using cache operator for Observables -
i following tutorials angular-university , in video suggest use cache()
operator avoid multiple requests. tried following:
this.posts$ = this.postsservice.savepost(post) .switchmap(() => this.postsservice.getposts()) .publishreplay(1) .refcount();
and works prefer cache()
instead of publishreplay
naive way achieve is:
this.postsservice.savepost(post) .subscribe(() => this.postsservice.getposts())
but not kind of reactive.
so prefer use cache
not find on add
operators.
currently using rxjs: 5.4.3
.
so, cache
supported version using?
cache gone of version 5.0.0 according the changlog
wiki
Comments
Post a Comment