Ticks in Angular Range slider component
17 Nov 20225 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 { Component } from '@angular/core';
@Component({
selector: 'my-app',
templateUrl: 'app/template.html',
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 { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import { SliderModule } from '@syncfusion/ej2-angular-inputs';
/**
* Module
*/
@NgModule({
imports: [
BrowserModule,
SliderModule
],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule { }
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';
enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);
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 { Component } from '@angular/core';
@Component({
selector: 'my-app',
templateUrl: 'app/template.html',
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 { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import { SliderModule } from '@syncfusion/ej2-angular-inputs';
/**
* Module
*/
@NgModule({
imports: [
BrowserModule,
SliderModule
],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule { }
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';
enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);
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 { Component } from '@angular/core';
@Component({
selector: 'my-app',
templateUrl: 'app/template.html',
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 { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import { SliderModule } from '@syncfusion/ej2-angular-inputs';
/**
* Module
*/
@NgModule({
imports: [
BrowserModule,
SliderModule
],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule { }
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';
enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);