Posts

Showing posts from December, 2020

what is observable in angular? promise vs observable.

Promise is active, whereas observable is lazy.  It means promise completes its next task till response comes. whereas observable do nothing and waits for the response. Promise is always asynchronous(start to run next code till response), whereas an Observable is default synchronous(don't run next code and wait for response) but you can make it asynchronous(you can forcefully make it asynchronous). Promise provide values only one time when you call the service. but Observable can continuously send value(notifications) on on fix time interval. for that you will have to set interval using "setInterval" function.