Interview Questions

1. What is the difference between Observables and Promises in Angular?

In Angular, as soon as we make a promise, the execution takes place, but this is not the case with observables because they are lazy. It means nothing happens until a subscription is made.

PromiseObservable
It emits a single value.It emits multiple values over a period of time.
Not LazyLazy. An observable is not called until we subscribe to the observable.
We can not cancel
it.
We can cancel it by using the unsubscribe() method.
Observable provides operators like map, forEach, filter, reduce, retry, retryWhen, etc.
By Md Riyazuddin 2 0
Is this helpful? Yes No

Submit an interview question

Submitted questions and answers are subject to review and editing, and may or may not be selected for posting, at the sole discretion of w3Sniff.

Get Started

Comments

Leave a Comment


Check out more interview questions

Based on your skills

MS SQL Server

97988 1720 4 860

Angular

2794 92 0 46

Wordpress

2158 72 0 36
AD Ad-Free