Are subscriptions to selectDate().subscribe(() => {}) supposed to be re-used? The documentation indicates that every time I want a new date, I should call selectDate() again, rather than re-use a subscription. This will result in a bunch of open subscriptions being created if you keep calling selectDate(), which is a memory leak.
I would expect the subject to immediately complete after getting the date:
pDialog.subscribe( (dialogReference: MdlDialogReference) => {
dialogReference.onHide().subscribe( (date: Date) => {
subject.next(date);
subject.complete(); // close the current subscription to selectDate()
});
});
Maybe I'm missing something, but in https://github.com/mseemann/angular2-mdl-ext/blob/master/src/components/datepicker/datepicker.service.ts#L37 you're returning a
Subject
as an observable, and when the dialog is hidden you provide the value to the subject usingSubject.next()
.Are subscriptions to
selectDate().subscribe(() => {})
supposed to be re-used? The documentation indicates that every time I want a new date, I should callselectDate()
again, rather than re-use a subscription. This will result in a bunch of open subscriptions being created if you keep callingselectDate()
, which is a memory leak.I would expect the subject to immediately complete after getting the date: