Recall & Review
beginner
What is an Observable in Angular?
An Observable is a way to handle multiple asynchronous events over time. It can emit many values, and you can listen to these values as they come.
Click to reveal answer
beginner
What is a Promise in Angular?
A Promise handles a single asynchronous event. It either resolves with a value or rejects with an error, but only once.
Click to reveal answer
intermediate
How does an Observable differ from a Promise in terms of values emitted?
An Observable can emit multiple values over time, while a Promise emits only one value or error once.
Click to reveal answer
intermediate
Can you cancel an Observable subscription? What about a Promise?
Yes, you can cancel an Observable subscription to stop receiving values. Promises cannot be cancelled once started.
Click to reveal answer
intermediate
Why might you choose an Observable over a Promise in Angular?
Choose Observable when you need to handle multiple values, streams of data, or want to cancel the operation. Use Promise for a single async result.
Click to reveal answer
Which of these can emit multiple values over time?
✗ Incorrect
Observables can emit many values over time, while Promises emit only one value or error.
Can you cancel a Promise once it starts?
✗ Incorrect
Promises cannot be cancelled once started; they either resolve or reject.
What does a Promise return when it completes successfully?
✗ Incorrect
A Promise returns a single value when it resolves successfully.
Which is better for handling streams of data in Angular?
✗ Incorrect
Observables are designed to handle streams of data and multiple values over time.
How do you stop receiving data from an Observable?
✗ Incorrect
You stop receiving data by unsubscribing from the Observable subscription.
Explain in your own words the main difference between an Observable and a Promise.
Think about how many values each can handle and if you can stop them.
You got /4 concepts.
Describe a situation in Angular where using an Observable is better than a Promise.
Consider when data comes in many pieces over time.
You got /4 concepts.