NG.II · Angular 22 practice question

A developer implements a custom resource loader for an asynchronous data fetch. If the initial parameters passed to the loader function result in a return value of `undefined`, what is the resulting status of the resource according to the framework's logic?

const loader = (params: ResourceLoaderParams) => {
  if (!params.dataConfig) {
    return undefined;
  }
  // ... actual loading logic
};
Choose one answer
Check answer and explanation

Correct answer: The resource status will immediately transition to 'idle' because the loader function was not executed.

Explanation

The resource status will immediately transition to 'idle' because the loader function was not executed.

Common trap

The suggestion that the resource status will remain in its previous state until a subsequent successful call is made is incorrect; the source specifies the transition to 'idle' when the parameter computation yields undefined. Furthermore, the idea that the resource status will transition to 'pending' because the loader is considered to be in the process of initializing is also wrong, as the loader never runs.

Source: Angular docs: Async reactivity with resources — Resource loaders
Checked against the cited text on 2026-11-25.

Report an error in this question