MCPcopy Create free account
hub / github.com/angular/components / MatSlider

Class MatSlider

src/material/slider/slider.ts:80–946  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78 imports: [MatSliderVisualThumb],
79})
80export class MatSlider implements AfterViewInit, OnDestroy, _MatSlider {
81 readonly _ngZone = inject(NgZone);
82 readonly _cdr = inject(ChangeDetectorRef);
83 readonly _elementRef = inject<ElementRef<HTMLElement>>(ElementRef);
84 readonly _dir = inject(Directionality, {optional: true});
85 readonly _globalRippleOptions = inject<RippleGlobalOptions>(MAT_RIPPLE_GLOBAL_OPTIONS, {
86 optional: true,
87 });
88
89 /** The active portion of the slider track. */
90 @ViewChild('trackActive') _trackActive!: ElementRef<HTMLElement>;
91
92 /** The slider thumb(s). */
93 @ViewChildren(MAT_SLIDER_VISUAL_THUMB) _thumbs!: QueryList<_MatSliderVisualThumb>;
94
95 /** The sliders hidden range input(s). */
96 @ContentChild(MAT_SLIDER_THUMB) _input!: _MatSliderThumb;
97
98 /** The sliders hidden range input(s). */
99 @ContentChildren(MAT_SLIDER_RANGE_THUMB, {descendants: false})
100 _inputs!: QueryList<_MatSliderRangeThumb>;
101
102 /** Whether the slider is disabled. */
103 @Input({transform: booleanAttribute})
104 get disabled(): boolean {
105 return this._disabled;
106 }
107 set disabled(v: boolean) {
108 this._disabled = v;
109 const endInput = this._getInput(_MatThumb.END);
110 const startInput = this._getInput(_MatThumb.START);
111
112 if (endInput) {
113 endInput.disabled = this._disabled;
114 }
115 if (startInput) {
116 startInput.disabled = this._disabled;
117 }
118 }
119 private _disabled: boolean = false;
120
121 /** Whether the slider displays a numeric value label upon pressing the thumb. */
122 @Input({transform: booleanAttribute})
123 get discrete(): boolean {
124 return this._discrete;
125 }
126 set discrete(v: boolean) {
127 this._discrete = v;
128 this._updateValueIndicatorUIs();
129 }
130 private _discrete: boolean = false;
131
132 /** Whether the slider displays tick marks along the slider track. */
133 @Input({transform: booleanAttribute})
134 get showTickMarks(): boolean {
135 return this._showTickMarks;
136 }
137 set showTickMarks(value: boolean) {

Callers

nothing calls this directly

Calls 2

_animationsDisabledFunction · 0.90
computedFunction · 0.85

Tested by

no test coverage detected