NG.VII · Angular 22 practice question
A developer calls this.http.get('/api/items') inside a service method without subscribing to the returned value. What happens at runtime?
const items$ = this.http.get('/api/items');
Check answer and explanation
Correct answer: No HTTP request is sent until something subscribes to items$.
Explanation
HttpClient returns cold Observables that act as blueprints, so no HTTP request is sent until something subscribes to items$.
Common trap
Sending immediately and caching describes a hot or Promise-based API like fetch, not a cold RxJS Observable. Leaving an Observable unsubscribed is completely valid in RxJS and never throws an error.
Source: Angular docs: Making HTTP requests — HTTP `Observable`s
Checked against the cited text on 2026-11-25.