Skip to main content

Observables different from Promises

 💪Difference between Observables and Promises😐


observables                                         Promises

========================================================

1.They handle multiple asynchronous      1. They deal with asynchronous event at a time

events over a period of time


2.They are lazy . they are not                2. They are not lazy. they are executed immediately

 executed until we                                  after creation

 was the subscribe() method


3.  Cancellable subscriptions                3.Promisses are not cancellable

using the unsubscribe() method.


4. They deliver errors to the                4. They push the errors to child promisses

 subscribers


5.Observables provide operation       5.They do not provide operations.

such as reduce , filter, retry,

and retry

Comments

Popular posts from this blog

ngModel in Angular

 ngModel :-                                                             ================== ngModel is a directive in angular that allow two way data binding. it bind th value of an HTML control (such as input, select, or textarea) to a prperty on the component and updates that property when the user changes th evalue in the control. To use "ngModel" in Angular, you need to import the formModule in your module And add it to the "imports" array. Then you can add the "ngModel" directive to an HTML controlin your template and  bind it to a property on ypur component using square brackets. Here is an example of using "ngModel" in a simple input form: Example:- <!-- component.html --> <input [(ngModel)]="name"> <!-- component.ts --> export class MyComponent {   name: string; } ================================== E...