Interview questions
Observable vs Promise
The classic async comparison, with the details that separate seniors.
What is tested: depth beyond "one value vs many". A Promise is eager (runs on creation), resolves once, and is not cancellable. An Observable is lazy (runs on subscribe), can emit many values, is cancellable via unsubscribe, and composes with operators.
A promise is a single letter already in the post; an observable is a magazine subscription you can start, pause, and cancel.
Key concepts
1
Observables are also synchronous or asynchronous, support multicasting, and provide built-in retry/debounce/throttle — which is why Angular uses them for HTTP, forms and router events.
synchronous or asynchronousmulticastingretry/debounce/throttle
2
Common wrong answer: "they are basically the same." The cancellation and laziness differences have real consequences — an unsubscribed HTTP observable actually aborts the request.
Common wrong answer:
3
Follow-up: "how do you convert between them?" — firstValueFrom(obs) / lastValueFrom(obs) for observable → promise, and from(promise) the other way.
Follow-up:firstValueFrom(obs)lastValueFrom(obs)from(promise)
typescript
// Observable → Promise when you truly want one value
const user = await firstValueFrom(this.http.get<User>('/api/me'));
// Promise → Observable to compose with operators
from(navigator.geolocation ? getPosition() : Promise.reject())
.pipe(retry(1))
.subscribe(pos => this.coords = pos);