Within my Angular 2 application, I utilize a communication service for disseminating messages across various Angular components.
@Injectable()
export class CommunicationService {
private _broadcast = new Subject<EventParam>();
broadcast$ = this._broadcast.asObservable();
public sendEvent(eventParameters: EventParam): void {
this._broadcast.next(eventParameters);
}
}
While the current setup works effectively, there are instances where I need to target a specific component to receive my message. Is there a way in RxJs to direct a message to a designated observer?