Skip to content

Commit

Permalink
Add note on displayLabel performance.
Browse files Browse the repository at this point in the history
  • Loading branch information
crisbeto committed Jan 17, 2017
1 parent f4a2a01 commit b78426e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lib/slider/slider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,9 @@ export class MdSlider implements ControlValueAccessor {

/** The value to be used for display purposes. */
get displayValue(): string|number {
// Note that this could be improved further by rounding something like 0.999 to 0.99 or
// 0.899 to 0.89, however it is very performance sensitive, because it gets called on
// every change detection cycle.
if (this._roundLabelTo && this.value % 1 !== 0) {
return this.value.toFixed(this._roundLabelTo);
}
Expand Down

0 comments on commit b78426e

Please sign in to comment.