← All Angular Web Framework Flashcard Decks

RxJS & Observables Flashcards

7 cards from real Angular Web Framework practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.

Read the first 7 RxJS & Observables flashcards as text
  1. Which RxJS operator transforms each emitted value into an Observable and flattens only the most recent inner Observable, canceling previous ones?

    Answer: switchMap

    switchMap unsubscribes from the previous inner Observable when a new source value arrives, making it ideal for cancellable requests like autocomplete.

  2. What does the RxJS `catchError` operator do when the source Observable errors?

    Answer: Returns a new Observable or rethrows the error

    catchError intercepts an error and lets you return a fallback Observable or rethrow it as a new error.

  3. Which Subject type in RxJS replays a specified number of past emissions to new subscribers?

    Answer: ReplaySubject

    ReplaySubject buffers a configurable number of emissions and replays them to any new subscriber.

  4. What is the purpose of the `takeUntil` operator in Angular component lifecycle management?

    Answer: Completes the Observable when a notifier Observable emits

    takeUntil is commonly used with a destroy$ Subject to automatically unsubscribe when a component is destroyed.

  5. Which RxJS creation operator converts a Promise into an Observable?

    Answer: from

    from accepts a Promise (as well as arrays and iterables) and wraps it in an Observable that emits the resolved value.

  6. What distinguishes a `cold` Observable from a `hot` Observable in RxJS?

    Answer: Cold Observables start producing values upon each subscription; hot Observables share a single execution

    Each subscriber to a cold Observable triggers an independent data producer, while hot Observables multicast from a shared source regardless of subscribers.

  7. Which operator combines multiple Observables and emits an array of their latest values whenever any source emits?

    Answer: combineLatest

    combineLatest emits a combined array of the latest values from all input Observables each time any one of them emits.