Angular · Senior · Question 10 of 75
What does httpResource (the resource API) provide?
userId = input.required<string>();
user = httpResource<User>(() => `/api/users/${this.userId()}`);
// template: @if (user.isLoading()) { ... } {{ user.value()?.name }}- ✓Correct answer: Signal-based async data: it refetches when signals in the request change and exposes
value,isLoading,error - 2A cache that stores HTTP responses in
localStorage - 3An RxJS operator for retrying failed requests
Explanation
Resources bring async data into the signal graph. When userId changes, the previous request is aborted and a new one starts. reload() refetches manually.