Skip to content

feat(slider): add the ability to apply custom formatting to thumb label #10243

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

Merged
merged 1 commit into from
Mar 6, 2018

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Mar 2, 2018

Adds the displayWith input on the slider that allows consumers to specify how the thumb label will be formatting. This is useful for cases like very large numbers where the number might be too long for the thumb label.

Fixes #9431.

@crisbeto crisbeto requested a review from mmalerba as a code owner March 2, 2018 18:30
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Mar 2, 2018

```ts
// Inside your component
@Component({ ... })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this to an embedded example?

* in the thumb label. Can be used to format very large number in order
* for them to fit into the slider thumb.
*/
@Input() displayWith: (value: number | null) => string | number;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

displayWith is kind of a weird name. What about formatter or formatFunction?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went with this one, because we use the same for the autocomplete.

@mmalerba mmalerba added the target: minor This PR is targeted for the next minor release label Mar 2, 2018
@crisbeto crisbeto force-pushed the 9431/slider-displaywith branch from f67c76a to dd1b5cd Compare March 2, 2018 21:07
Adds the `displayWith` input on the slider that allows consumers to specify how the thumb label will be formatting. This is useful for cases like very large numbers where the number might be too long for the thumb label.

Fixes angular#9431.
@crisbeto crisbeto force-pushed the 9431/slider-displaywith branch from dd1b5cd to 6032964 Compare March 3, 2018 17:13
@crisbeto crisbeto requested review from amcdnl and jelbourn as code owners March 3, 2018 17:13
@crisbeto
Copy link
Member Author

crisbeto commented Mar 3, 2018

Addressed the feedback @mmalerba.

@mmalerba mmalerba added pr: lgtm action: merge The PR is ready for merge by the caretaker and removed pr: needs review labels Mar 5, 2018
@jelbourn jelbourn merged commit d01c58c into angular:master Mar 6, 2018
@britvik
Copy link

britvik commented Mar 20, 2018

Is this not in 5.2.4 release? I just upgraded and cannot see the feature.

@mmalerba
Copy link
Contributor

This PR is marked as release: minor which means it can't go in a patch release. Since we don't plan to do any more minors before 6.0.0, that will likely be the first release to include it.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Slider thumb values getting too big!
5 participants