How to convert Promise to Observable in Angular

How to convert Promise to Observable in Angular

A promise is a future value. An observable is a flow of past and future values. So it makes sense to convert a list of promises into an observable.

Angular implements Observable in their API out of the box. Sometimes if you need to convert Promise to Observable in angular, you can do it quickly. Check out the following code snippet

import { from } from  'rxjs';
const observable = from(promise);

إرسال تعليق

Please do not post any spam link in the comment box😊

أحدث أقدم

Blog ads

CodeGuru