Subject Subscription is triggered twice when I call .next() once in Angular app
问题 i'm trying to create a reusable Modal component. in a ModalService i have a Subject, and a method that that calls next() on the subject. The ModalComponent subscribes to that subject, but whenever the method in the service is being called, the next function of the observer gets triggers twice. Anyone know what causes this? export class ModalService { openModal = new Subject(); constructor() { } open(cmp) { this.openModal.next(cmp); } } Modal Component: export class ModalComponent implements