1 year ago

#358969

test-img

Sparrow

How to use same instance of service in pop up window?

I am trying to use a communication service to send some data between different angular components. But I am facing an issue when the child component is opened inside a pop-up window. Since it is a separate angular app itself. So it's taking a different instance of the service and thus I am unable to send data.

This is my communication Service.

import { Injectable } from "@angular/core";
import { Subject } from "rxjs";

@Injectable()
export class CommunicatingService {
  private subject = new Subject<any>();
  sub = this.subject.asObservable()
  constructor() {}

  nextSub(data: any) {
    this.subject.next(data)
  }
}

javascript

angular

frontend

popupwindow

angular12

0 Answers

Your Answer

Accepted video resources