skip to Main Content

The code used to work in Angular 14 but is not working in Angular 15.

    <mat-slider
            min="1"
            max="150"
            step="10"
            value="55"
            #itemHeight
     >
     </mat-slider>

     <label> {{ itemHeight.value  }} hie </label>

StackBlitz link => https://stackblitz.com/edit/angular-ixbgdr?file=src%2Fmain.ts

2

Answers


  1. You now have to pass an input to the slider :

      <mat-slider min="1" max="5" step="0.5" value="1.5">
         <input matSliderThumb #itemHeight>
      </mat-slider>
    
      <label>  {{itemHeight.value}} </label>
    
    Login or Signup to reply.
  2. Any changes are clearly outlined in the MDC migration guide – MDC Migration Guide

    You would have found your answer also from the docs for the slider component – Material Docs

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search