-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(select): allow for option sorting logic to be customized #11890
feat(select): allow for option sorting logic to be customized #11890
Conversation
src/lib/select/select.ts
Outdated
* Function used to sort the values inside a select in multiple mode. | ||
* Follows the same logic as `Array.prototype.sort`. | ||
*/ | ||
@Input() sortPredicate: (a: MatOption, b: MatOption, options: MatOption[]) => number = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Predicate" isn't the right term, since a predicate is something that always returns a boolean value. I think sortComparator
would be more accurate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL. I've renamed it to sortComparator
.
a3c404f
to
5282b2b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Looks like this has failures on travis now |
5282b2b
to
ac5913e
Compare
Adds an input for a `sortComparator` to `mat-select`. The new input allows consumers to override the logic that `mat-select` uses to sort its values. Fixes angular#11871.
ac5913e
to
0d3ae16
Compare
Fixed the test failures. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Adds an input for a
sortComparator
tomat-select
. The new input allows consumers to override the logic thatmat-select
uses to sort its values.Fixes #11871.