I want to communicate from children to the parent as described in the Angular cookbook. A service creates Subject through which to communicate:
progressSubject = new Subject<ProgressMessage>
The parent subscribes to the Subject and reacts on messages:
this.service.progressSubject.subscribe(msg => showProgress(msg))
Clients can use progressSubject.next() to send messages, which works fine.
However, if I want to subscribe the progressSubject to another Observable, all subscriptions terminate if the source observable completes. The parent will not react to input anymore.
let first = new Subject();
first.subscribe(this.service.progressSubject);
first.next(3); // value is processed by subscribers to progressSubject
first.complete();
let second= new Subject();
second.subscribe(this.service.progressSubject);
second.next(3); // original subcription to progressSubject is ended,
// value is not processed anymore.
How can I ignore the "complete" event on a Subject, so that multiple sources can connect to that Subject?