from a controller I input a parameter to a subject
selectImport(event){
this.importacionService.onChildSelectImportChanged.next(event);
}
and from my component importacion.component.ts
I subscribe to this subject
this.importacionService.onSelectImportChanged.subscribe( addImport => {
this.importacionService.addImport(this.month, addImport);
});
}
Now everything is fine but when I close the dialog of importacion.component.ts and I'll do it again, the subject creates a second suscbripcion and therefore 2 observers, then when I enter a new data with .next() the subscriber runs twice .
how can I control this behavior, my expected behavior is that only exist and parameter in my subject and only run when its value changes