Skip to content

Commit aae6083

Browse files
pweyrichamysorto
authored andcommitted
fix(material/list): wrong order of arguments when calling custom compareWith function (#24743)
* fix(material/list): wrong order of arguments when calling custom compareWith function Fixes a bug in Angular Material `selection-list` component where the order of arguments passed to a custom compareWith function was mixed up during initialization of a MatListOption. Expected order based on documentation is: 1. value of the respective option 2. value of the selection * fix(material-experimental/mdc-list): wrong order of arguments when calling custom compareWith function Fixes a bug in Angular Material's experimental mdc-selection-list component where the order of arguments passed to a custom compareWith function was mixed up during initialization of a MatListOption. Expected order based on documentation is: 1. value of the respective option 2. value of the selection (cherry picked from commit fa12442)
1 parent 4f19bcf commit aae6083

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/material-experimental/mdc-list/list-option.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ export class MatListOption extends MatListItemBase implements ListOption, OnInit
179179
ngOnInit() {
180180
const list = this._selectionList;
181181

182-
if (list._value && list._value.some(value => list.compareWith(value, this._value))) {
182+
if (list._value && list._value.some(value => list.compareWith(this._value, value))) {
183183
this._setSelected(true);
184184
}
185185

src/material/list/selection-list.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ export class MatListOption
212212
ngOnInit() {
213213
const list = this.selectionList;
214214

215-
if (list._value && list._value.some(value => list.compareWith(value, this._value))) {
215+
if (list._value && list._value.some(value => list.compareWith(this._value, value))) {
216216
this._setSelected(true);
217217
}
218218

0 commit comments

Comments
 (0)