NG.VI · Angular 22 practice question

A casting application must verify that a requested role is not already taken, but the list of active roles changes constantly in a central database. Why is an async validator appropriate here?

Choose one answer
Check answer and explanation

Correct answer: The validator must perform an asynchronous lookup against the central database because available roles cannot be fetched ahead of time.

Explanation

When the set of valid entries changes continuously and cannot be retrieved upfront, an async validator is needed to query the central database asynchronously.

Common trap

Synchronous validators are routinely attached to reactive FormControl instances; they just cannot wait for remote database lookups. Async validators do not automatically persist results in localStorage; they simply allow asynchronous validation checks.

Source: Angular docs: Validating form input — Implementing a custom async validator
Checked against the cited text on 2026-11-25.

Report an error in this question