angularangular-materialangular-material2

Mat Slider value not getting updated while sliding


Mat slider value is not sync updated while sliding.

<mat-slider [(ngModel)]="myValue" step="1" min="0" max="100" ></mat-slider>
{{myValue}} 

It just got updated only after release slider thumb.


Solution

  • Using the javascript input event:

    <mat-slider [(ngModel)]="myValue" (input)="myValue = $event.value"></mat-slider>