I'm faced with a dilemma involving my sizzling RxJS Observable that demands different responses based on the application's context. This Subject triggers a new event triggered by a global action caught by a special directive, but I'm at a loss for what to do next.
- If a child component is subscribed to the Subject, should the child handle the event?
- Or should a global handler be utilized instead?
I thought about checking the number of subscribers in the Subject and instructing the global handler to ignore if there are more than one subscriber, but it doesn't seem like the recommended approach. What would be the right way to tackle this issue?
Furthermore, where should the global event handler reside - within the directive, the service, or should it belong in a whole new component?