-1

I am trying to implement communication between two windows.

I open a component new 2 window by using Window.open().

The problem its same component 2 different instance in 2 windows not able to communicate between that 2 windows.

Can you please help in this?

Ravi Makwana
  • 2,782
  • 1
  • 29
  • 41
  • Refer this https://stackoverflow.com/questions/49364941/how-to-pass-service-data-from-one-to-another-component-in-angular-5 – hrdkisback Jan 30 '20 at 11:14
  • https://angularfirebase.com/lessons/sharing-data-between-angular-components-four-methods/ Hope this helps! – Anil Kumar Reddy A Jan 30 '20 at 11:14
  • 1
    it wont'possible you did't get event for that you can use socket for the same and for that you also need to change the code of backend – Yash Rami Jan 30 '20 at 11:21

1 Answers1

1

You could try BroadsastChannel API: https://developer.mozilla.org/en-US/docs/Web/API/Broadcast_Channel_API

This is the kind of scenario that it is made for.

It is fairly simple. Taken from the docs:

// Connection to a broadcast channel
var bc = new BroadcastChannel('test_channel');

// Example of sending of a very simple message
bc.postMessage('This is a test message.');

// Example of a simple event handler that only
// logs the event to the console
bc.onmessage = function (ev) { console.log(ev); }

// Disconnect the channel
bc.close()
CaeSea
  • 288
  • 1
  • 2
  • 11