Skip to content

Commit 67f3faa

Browse files
committed
Add unsubscribe for 'this.options.changes.subscribe((options: QueryList<MdListOption>)' in onDistory();
1 parent a95abf6 commit 67f3faa

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/lib/list/list.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ export class MdSelectionList implements AfterContentInit, OnDestroy {
219219
/** Subscription to tabbing out from the selection-list. */
220220
private _tabOutSubscription: Subscription;
221221

222+
/** Subscription to option changes from the selection-list. */
223+
private _optionSubscription: Subscription;
224+
222225
/** Whether or not the option is selectable. */
223226
protected _selectable: boolean = true;
224227

@@ -260,7 +263,8 @@ export class MdSelectionList implements AfterContentInit, OnDestroy {
260263
this._subscribeOptions(this.options);
261264

262265
// When the list changes, re-subscribe
263-
this.options.changes.subscribe((options: QueryList<MdListOption>) => {
266+
this._optionSubscription =
267+
this.options.changes.subscribe((options: QueryList<MdListOption>) => {
264268
this._subscribeOptions(options);
265269
});
266270
}
@@ -269,6 +273,10 @@ export class MdSelectionList implements AfterContentInit, OnDestroy {
269273
if (this._tabOutSubscription) {
270274
this._tabOutSubscription.unsubscribe();
271275
}
276+
277+
if (this._optionSubscription) {
278+
this._optionSubscription.unsubscribe();
279+
}
272280
}
273281

274282
/**

0 commit comments

Comments
 (0)