โ† All Angular Web Framework Flashcard Decks

State Management & Change Detection Flashcards

6 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 6 State Management & Change Detection flashcards as text
  1. Which Angular strategy checks only the current component and its ancestors when an input reference changes?

    Answer: OnPush

    OnPush change detection only runs for a component when its input references change, an event originates from it, or an async pipe resolves.

  2. What method on ChangeDetectorRef temporarily stops change detection for a component subtree?

    Answer: detach()

    detach() removes the component from the change detection tree until reattach() is called.

  3. Which NgRx building block is a pure function that takes the current state and an action, and returns a new state?

    Answer: Reducer

    A reducer is a pure function (state, action) => newState that never mutates the existing state object.

  4. In NgRx, which construct handles side effects such as HTTP calls and dispatches new actions on completion?

    Answer: Effect

    NgRx Effects listen for dispatched actions, perform side effects, and optionally dispatch new actions back to the store.

  5. Which NgRx function creates a memoized, reusable piece of state-derived data?

    Answer: createSelector()

    createSelector() returns a memoized selector that recomputes only when its input selectors produce new values.

  6. What does calling markForCheck() on a component using OnPush change detection do?

    Answer: Marks the component and its ancestors to be checked on the next cycle

    markForCheck() flags the component and its ancestors so Angular includes them in the next change detection run.