colors-app | Demo of flatterners, http and rxMethod |
- We talked about Higher Order Observables -
Observable<Observable<T>>
- We saw how to create higher order observable using the
map
operator along with a factory method.
const order1$ = interval(1000);
const order2$ = order1$.pipe(
map(i => interval(1000))
);
/*
order2$ is of type Observable<Observable<number>>
*/
- We understood why it's a bad practice to use
subscribe
insidesubscribe
, and therefore why it's important to "Flatten" the observable. - We saw 4 types of flattening operators:
mergeAll
, andmergeMap
- Merges allnexts
from all inner observablesswitchAll
, andswitchMap
- Subscribes always to the latest observableconcatAll
andconcatMap
- Subscribes to the observables one after the other sequentiallyexhaustAll
andexhaustMap
- Subscribes to observables until completion only when idle
- We saw how to provide Http by using the
provideHttpClient()
function inapp.congig
- We saw how to inject
HttpClient
to services - We understood that the http client works with Cold Observables
- We saw how to call the
get<T>
function to fetch data from the web - We saw that using the proper flattening operator, we can also cancel requests that are no longer relevant
- We understood what
rxMethod
is - we understood that it is a method that accepts 3 types of input- T
- Observable
- Signal
- We understood that it accepts a method as parameter
- We understood that the method accepts an observable and should respond to it using operators
- We saw that we can use
rxMethod
for integration between signal store and reactive services (asyncronous services) - We saw how to connect
http
with signal store