Skip to content

Commit

Permalink
fix(material/list): wrong order of arguments when calling custom comp…
Browse files Browse the repository at this point in the history
…areWith 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)
  • Loading branch information
pweyrich authored and amysorto committed Apr 12, 2022
1 parent 4f19bcf commit aae6083
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/material-experimental/mdc-list/list-option.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export class MatListOption extends MatListItemBase implements ListOption, OnInit
ngOnInit() {
const list = this._selectionList;

if (list._value && list._value.some(value => list.compareWith(value, this._value))) {
if (list._value && list._value.some(value => list.compareWith(this._value, value))) {
this._setSelected(true);
}

Expand Down
2 changes: 1 addition & 1 deletion src/material/list/selection-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export class MatListOption
ngOnInit() {
const list = this.selectionList;

if (list._value && list._value.some(value => list.compareWith(value, this._value))) {
if (list._value && list._value.some(value => list.compareWith(this._value, value))) {
this._setSelected(true);
}

Expand Down

0 comments on commit aae6083

Please sign in to comment.