The previous example showcased how to combine multiple ongoing `Observables` to one result. However, there are situations
The previous example showcased how to combine multiple ongoing `Observables` to one result. However, there are
where it is necessary to access the latest value from an `Observable` after a specific event occurs.
situations where it is necessary to access the latest value from an `Observable` after a specific event occurs.
`withLatestFrom` combines the last _emitted_ value of the a provided source `Observable` to an active stream of data.
`withLatestFrom` combines the last _emitted_ value of the provided source `Observable` to an active stream of data.
In this example we want to get the latest value of the `timer$` whenever a user clicks on the document.
We will utilize the `withLatestFrom` operator in this exercise to setup a _staging_ area for new incoming `BlogPost`
in order to achieve user controller opt-in updates for the view.
## Behavior
An example where the latest value of `b$` is logged after a user clicks on the document.
```Typescript
```Typescript
import { fromEvent, interval } from 'rxjs';
import { fromEvent, interval } from 'rxjs';
import { withLatestFrom } from 'rxjs/operators';
import { withLatestFrom } from 'rxjs/operators';
const click$ = fromEvent(document, 'click'); // get the click event
const input$ = fromEvent(document, 'click'); // get the click event
const timer$ = interval(1000);
const b$ = interval(1000);
const result = click$.pipe(withLatestFrom(timer$));
const result = input$.pipe(withLatestFrom(b$));
result.subscribe(([clickEvent, latestTimerValue]) => console.log(latestTimerValue)); // logs the latest value of the timer
result.subscribe(([clickEvent, latestTimerValue]) => console.log(latestTimerValue)); // logs the latest value of the timer
```
```

_The visual representation of this example_
If the _outer_ `Observable`, you originally subscribed to, or the _inner_ `Observable` which you applied `withLatestFrom`
to raises an `error`, the end result will be an `error` too.