ngAir 205 - Push-Based Architectures with RxJS with Thomas Burleson

AngularAir · 6K views · 2019 · 1:23:21

Open on YouTube

Web developmentSoftware architecture & designFunctional programmingtalk

Why Stack Overflow recommends it

Stack Overflow users link it when answering questions about caching API data, refreshing observables and building facade services with BehaviorSubjects in Angular.

Recommended by 1 people across 1 different months, 2019 to 2022.

What it is

An AngularAir livestream episode (ngAir 205) where Thomas Burleson demos push-based architectures in Angular using RxJS. He shows how a facade pattern around state management simplifies component code and data flow.

What people said

Recommends Mike · 2022-09 · Stack Overflow · on “How to correctly save data fetched from an api in an angular app, so that we won't make a request if we visit that page again like by going back?”

Create public observables in blogs_storage.service.ts instead of returning the BehaviorSubjects. And then where the service is used, then subscribe to the observables. Here is a good video that does a good explanation. It is long but you can watch it at 1.25 or 1.5 speed. [this video]

Cites sebaLinares · 2019-09 · Stack Overflow · on “BehaviorSubject keeps reseting inside lazy loaded module”

I'm trying to implement a facade.service for a lazy loaded module. Stackblitz link [LINK] facade @Injectable() export class TaFacadeService { private _state: TAState; private _store: BehaviorSubject<TAState>; private _state$: Observable<TAState>; ano$: Observable<number>; loading$: Observable<boolean>; mes$: Observable<number>; tarjetas$: Observable<DatoListaAmarilla[]>; url$: Observable<string>; rutaSubscription: Subscription; codUser: string; urlEp: any; /** * Viewmodel que computa el estado completo una vez que esta listo * o es actualizado */ vm$: Observable<TAState> = combineLatest( this.ano$, this.loading$, this.mes$, this.tarjetas$, this.url$ ).pipe( map(([ano, loading, mes, tarjetas,

Cites BizzyBob · 2021-09 · Stack Overflow · on “Angular 2+ cached HTTP request force reload”

I think the simplest way to achieve what you are looking for is to use a single Subject as a trigger to fetch the data. Then define an allProducts$ observable on the service ( instead of a method ) that depends on this "fetch subject". Provide a simple refreshProducts() method that calls .next() on the fetch subject, which will cause allProduct$ to refetch the data. Consumers can simply subscribe to allProducts$ and receive the latest array of products. They can call refreshProducts() to reload data. There will be no need to reassign references to subjects or observables. export class ProductService { private fetch$ = new BehaviorSubject<void>(undefined); public allProducts$: Observable<IPro