Ticks in Angular Range slider component
27 Apr 20245 minutes to read
The Ticks in Slider supports you to easily identify the current value/values of the Slider. It contains smallStep
and largeStep
. The value of the major ticks alone will be displayed in the slider. In order to enable/disable the small ticks, use the showSmallTicks
property.
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { SliderModule } from '@syncfusion/ej2-angular-inputs'
import { Component } from '@angular/core';
@Component({
imports: [
SliderModule
],
standalone: true,
selector: 'my-app',
template: `
<div id='container'>
<div class='wrap'>
<ejs-slider id='slider' [tooltip]= 'tooltip' [ticks]='ticks' [value] = 'value' ></ejs-slider>
</div>
</div>`,
styleUrls:['./index.css']
})
export class AppComponent {
public value: number =30;
public tooltip: Object = { placement: 'Before', isVisible: true, showOn: 'Always' };
public ticks: Object = { placement: 'After', largeStep: 20, smallStep: 10, showSmallTicks: true };
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
Step
When the Slider is moved, it increases/decreases the value based on the step value. By default, the value is increased/decreased by 1. Use the step
property to change the increment step value.
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { SliderModule } from '@syncfusion/ej2-angular-inputs'
import { Component } from '@angular/core';
@Component({
imports: [
SliderModule
],
standalone: true,
selector: 'my-app',
template: `
<div id='container'>
<div class='wrap'>
<ejs-slider id='slider' [value]='value' [tooltip]="tooltip" [ticks] = 'ticks' [step] = 'step' ></ejs-slider>
</div>
</div>`,
styleUrls:['./index.css']
})
export class AppComponent {
public value: number = 30;
public tooltip: Object = { placement: 'Before', isVisible: true, showOn: 'Always' };
public ticks: Object = { placement: 'After', largeStep: 20, smallStep: 10, showSmallTicks: true };
public step: number = 10;
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
Min and Max
Enables the minimum/starting and maximum/ending value of the Slider, by using the min
and max
property. By default, the minimum value is 1 and maximum value is 100. In the following sample the slider is rendered with the min value as 100 and max value as 1000.
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { SliderModule } from '@syncfusion/ej2-angular-inputs'
import { Component } from '@angular/core';
@Component({
imports: [
SliderModule
],
standalone: true,
selector: 'my-app',
template: `
<div id='container'>
<div class='wrap'>
<ejs-slider id='slider' [min]= 'min' [max]= 'max' [value]= 'value' [tooltip]='tooltip'
[ticks] = 'ticks' ></ejs-slider>
</div>
</div>`,
styleUrls:['./index.css']
})
export class AppComponent {
public min: number = 0;
public max: number = 100;
public value: number = 30;
public ticks: Object = { placement: 'After', largeStep: 20, smallStep: 10, showSmallTicks: true };
public tooltip: Object = { placement: 'Before', isVisible: true, showOn: 'Always' };
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));