I'm working on a project that requires me to display 2 different components in separate browser windows. I've tried opening two windows and displaying the components, but now I'm wondering if there's a way for a component in one window to interact with another component in the second window.
I attempted to create a Subject
in a Service, but when I try to subscribe to this Subject in the component of the other window, it doesn't seem to work. Here is an example of what I have done:
export class MyService {
public navigationTrigger: Subject<NavigationParams> = new Subject();
constructor(private _http: Http) {
this.navigationTrigger.next(params);
}
}
And in the component, I subscribe to it like this:
this.watsonService.navigationTrigger.subscribe((navigation) => {
this.updateNavigation(navigation);
});
Unfortunately, this approach does not seem to be achieving the desired result. I am still unsure how to proceed in order to make this interaction between components in separate windows possible.