Hamza Qureshi
Hamza Qureshi

Reputation: 43

How to get mat-slider in Angular to select from a particular set of values?

I am working on a project that aims to display literacy rates around the world for particular years. Currently, we have data ranging from 1475 to 2015. However, not every single year holds data. Only 10-12 years actually hold some data. As a result, I don't want the user to have to drag and search between every single year for one that holds data.

I am not sure how to make the mat-slider only pick certain years. Here is the code I currently have for the mat-slider:

<div id = "sliderBox">
    <mat-slider [(ngModel)] = "currentYear" min="1475" max = "2015"  (slideend)="onSlide()" (pointerup)="onSlide()"></mat-slider>
</div>

So basically I want currentYear to only ever be certain values e.g. 1475, 1677, 1948 etc...

Thanks in advance!

Upvotes: 0

Views: 564

Answers (0)

Related Questions