Return to site

🅰️ Sharing data between Angular components with observables

· angular

👀See: https://lnkd.in/efKNXAxi

In Angular applications, components need to communicate, and RxJS Observables help facilitate this interaction by allowing data sharing through subscriptions.

🔔 Observables – Work like a newsletter subscription: when new data is emitted, all subscribers receive updates.

🔄 Subjects – A special type of Observable that allows multiple listeners to receive the same emitted value.

Types of Subjects:
🎯 Subject – A basic multicast Observable where multiple subscribers get the same emitted value.
📌 BehaviorSubject – Similar to a Subject, it immediately emits the last stored value upon subscription, making it useful for managing state.
🚀 Subject– Emits events without carrying a value, ideal for notifying actions (e.g., user interactions, process completion).

broken image