How to emit changes when mat-slider is moved?

Issue

I have the following slider:

<mat-slider
tickInterval="1000"
thumbLabel
(change)="opacityBackgroundChange($event)"
[(ngModel)]="opacityBackgroundColor"
step="0.01"
min="0"
max="1"
></mat-slider>

Why (change) works only when mouse is push down? How to emit values duting movement?

Solution

See the API for MatSlider: https://material.angular.io/components/slider/api

There is also:

@Output()
input: EventEmitter<MatSliderChange>

property you can use:

<mat-slider
  ...
  (input)="onInput($event)"
  ...
></mat-slider>

Answered By – mrak

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published