File tree Expand file tree Collapse file tree 2 files changed +6
-11
lines changed
tools/public_api_guard/material Expand file tree Collapse file tree 2 files changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -181,11 +181,6 @@ export class MatSlider extends _MatSliderBase
181
181
get min ( ) : number { return this . _min ; }
182
182
set min ( v : number ) {
183
183
this . _min = coerceNumberProperty ( v , this . _min ) ;
184
-
185
- // If the value wasn't explicitly set by the user, set it to the min.
186
- if ( this . _value === null ) {
187
- this . value = this . _min ;
188
- }
189
184
this . _percent = this . _calculatePercentage ( this . _value ) ;
190
185
191
186
// Since this also modifies the percentage, we need to let the change detection know.
@@ -233,16 +228,16 @@ export class MatSlider extends _MatSliderBase
233
228
234
229
/** Value of the slider. */
235
230
@Input ( )
236
- get value ( ) : number | null {
231
+ get value ( ) : number {
237
232
// If the value needs to be read and it is still uninitialized, initialize it to the min.
238
233
if ( this . _value === null ) {
239
234
this . value = this . _min ;
240
235
}
241
- return this . _value ;
236
+ return this . _value as number ;
242
237
}
243
- set value ( v : number | null ) {
238
+ set value ( v : number ) {
244
239
if ( v !== this . _value ) {
245
- let value = coerceNumberProperty ( v ) ;
240
+ let value = coerceNumberProperty ( v , 0 ) ;
246
241
247
242
// While incrementing by a decimal we can end up with values like 33.300000000000004.
248
243
// Truncate it to ensure that it matches the label and to make it easier to work with.
Original file line number Diff line number Diff line change @@ -23,8 +23,8 @@ export declare class MatSlider extends _MatSliderBase implements ControlValueAcc
23
23
set thumbLabel ( value : boolean ) ;
24
24
get tickInterval ( ) : 'auto' | number ;
25
25
set tickInterval ( value : 'auto' | number ) ;
26
- get value ( ) : number | null ;
27
- set value ( v : number | null ) ;
26
+ get value ( ) : number ;
27
+ set value ( v : number ) ;
28
28
readonly valueChange : EventEmitter < number | null > ;
29
29
valueText : string ;
30
30
get vertical ( ) : boolean ;
You can’t perform that action at this time.
0 commit comments