bollam_rohith
bollam_rohith

Reputation: 384

Change value of mat-slider to default value on click of button

<mat-slider thumbLabel min="0" max="100" step="1" value="0" >

<button type="button" (click)="Refresh()">Click Me!</button>

Refresh(){
// What should be written in this

}

Suppose I changed this slider and when I click on refresh button, I need to adjust the value again to zero

Can any one explain how to do it..

ThankYou....!!!!

Upvotes: 1

Views: 1898

Answers (1)

Alexis
Alexis

Reputation: 1784

Simply add value as ngModel to change it as needed

Here is a stackblitz example

ts

value: number = 0

Refresh(){
  this.value = 0
}

html

<mat-slider thumbLabel min="0" max="100" step="1" [(ngModel)]="value" ></mat-slider>
<button type="button" (click)="Refresh()">Click Me!</button>

Upvotes: 1

Related Questions