Smart Dickson
Smart Dickson

Reputation: 23

Mat slider not works after migrate to Angular 14 ->15

Error slider

when i am using mat slider in angular 15 i got err likeerr msg my slider is not moving it is a project migrated from angular 14 to 15. Did anyone know how to fix this?

crt slider I want a slider like this old.

Upvotes: 1

Views: 715

Answers (1)

Tom
Tom

Reputation: 214

From Angular Material 14 to 15 there have been some major changes. You can view the details here: https://material.angular.io/guide/mdc-migration

Without seeing your code it is hard to help you in detail, but I think you will find all needed answers if you try to adapt to the following.

Firstly, you should update your Material version like this:

ng generate @angular/material:mdc-migration

But nonetheless this might break some of your functionality. The parameters for mat-slider have changed. You can view the details here: https://material.angular.io/guide/mdc-migration#slider

As a quick fix, Angular Material preserved some of the old components. You can access them by changing your imports to the legacy components:

import {MatLegacySliderModule } from '@angular/material/legacy-slider';

Nonetheless, I would recommend updating your code to the new material components. I had the same issue and at first it seemed like a lot of work to me. But in the end it is not too complicated to adjust everything and get it running again.

Stay healthy, Tom

Upvotes: 0

Related Questions