Posts

Showing posts from April, 2025

ng-event-bus

Real-Time Notifications in Angular with ng-event-bus Ever built an Angular app where components needed to communicate without being directly connected? Maybe you wanted a global notification system  that updates instantly, no matter where the user is in your app? That’s where `ng-event-bus` shines. It acts as a lightweight event bus, letting different parts of your application talk to each other seamlessly. In this article, we’ll build a real-time notification system using `ng-event-bus`—no messy service injections, no complex state management. Why Use ng-event-bus ? Let’s face it: passing data between unrelated components in Angular can be a headache. Services with `Subject` and `BehaviorSubject` from RxJS work, but they require dependency injection, which isn’t always convenient. `ng-event-bus` provides a simple, global event system that makes component communication effortless. It’s great for: ✅ Notifications (like we’ll build today!). ✅ Inter-component communication without tig...