@@ -93,6 +93,7 @@ export class MatSelectionListChange {
93
93
} )
94
94
export class MatListOption extends _MatListOptionMixinBase
95
95
implements AfterContentInit , OnDestroy , OnInit , FocusableOption , CanDisableRipple {
96
+
96
97
private _lineSetter : MatLineSetter ;
97
98
private _selected : boolean = false ;
98
99
private _disabled : boolean = false ;
@@ -132,6 +133,13 @@ export class MatListOption extends _MatListOptionMixinBase
132
133
}
133
134
}
134
135
136
+ /**
137
+ * Emits a change event whenever the selected state of an option changes.
138
+ * @deprecated Use the `selectionChange` event on the `<mat-selection-list>` instead.
139
+ */
140
+ @Output ( ) selectionChange : EventEmitter < MatSelectionListChange > =
141
+ new EventEmitter < MatSelectionListChange > ( ) ;
142
+
135
143
constructor ( private _renderer : Renderer2 ,
136
144
private _element : ElementRef ,
137
145
private _changeDetector : ChangeDetectorRef ,
@@ -180,6 +188,9 @@ export class MatListOption extends _MatListOptionMixinBase
180
188
181
189
// Emit a change event if the selected state of the option changed through user interaction.
182
190
this . selectionList . _emitChangeEvent ( this ) ;
191
+
192
+ // TODO: the `selectionChange` event on the option is deprecated. Remove that in the future.
193
+ this . _emitDeprecatedChangeEvent ( ) ;
183
194
}
184
195
}
185
196
@@ -214,6 +225,12 @@ export class MatListOption extends _MatListOptionMixinBase
214
225
215
226
this . _changeDetector . markForCheck ( ) ;
216
227
}
228
+
229
+ /** Emits a selectionChange event for this option. */
230
+ _emitDeprecatedChangeEvent ( ) {
231
+ // TODO: the `selectionChange` event on the option is deprecated. Remove that in the future.
232
+ this . selectionChange . emit ( new MatSelectionListChange ( this . selectionList , this ) ) ;
233
+ }
217
234
}
218
235
219
236
@@ -250,7 +267,7 @@ export class MatSelectionList extends _MatSelectionListMixinBase implements Focu
250
267
@ContentChildren ( MatListOption ) options : QueryList < MatListOption > ;
251
268
252
269
/** Emits a change event whenever the selected state of an option changes. */
253
- @Output ( ) change : EventEmitter < MatSelectionListChange > =
270
+ @Output ( ) selectionChange : EventEmitter < MatSelectionListChange > =
254
271
new EventEmitter < MatSelectionListChange > ( ) ;
255
272
256
273
/** The currently selected options. */
@@ -330,7 +347,7 @@ export class MatSelectionList extends _MatSelectionListMixinBase implements Focu
330
347
331
348
/** Emits a change event if the selected state of an option changed. */
332
349
_emitChangeEvent ( option : MatListOption ) {
333
- this . change . emit ( new MatSelectionListChange ( this , option ) ) ;
350
+ this . selectionChange . emit ( new MatSelectionListChange ( this , option ) ) ;
334
351
}
335
352
336
353
/** Implemented as part of ControlValueAccessor. */
@@ -390,6 +407,9 @@ export class MatSelectionList extends _MatSelectionListMixinBase implements Focu
390
407
// Emit a change event because the focused option changed its state through user
391
408
// interaction.
392
409
this . _emitChangeEvent ( focusedOption ) ;
410
+
411
+ // TODO: the `selectionChange` event on the option is deprecated. Remove that in the future.
412
+ focusedOption . _emitDeprecatedChangeEvent ( ) ;
393
413
}
394
414
}
395
415
}
0 commit comments