2.0.6 • Published 6 years ago

ngx-slider-moby v2.0.6

Weekly downloads
40
License
-
Repository
github
Last release
6 years ago

Ngx Slider Moby.

Reactive slider/scope slider component for angular.

Live demo: https://pavelpleshko-slider-moby.now.sh

Screenshot

main_screen

Get started

Slider supports touch events for mobile devices.

Install package itself

npm install ngx-slider-moby --save

How to use

Include NgxSliderMobyModule into your module like so:

import { NgxSliderMobyModule } from 'ngx-slider-moby';
...
@NgModule({
  imports: [
    NgxSliderMobyModule
  ],
})
export class YourModule { }

Inclusion of module will give you access to the slider component which you can include in your components. Example:

<ngx-slider-moby [max_value]="300" [min_value]="0" [range]="true"></ngx-slider-moby>

Can be used as form control(implements ControlValueAccessor interface) like so:

<div [formGroup]="myForm">
<ngx-slider-moby [max_value]="300" [min_value]="0" [range]="true" formControlName="priceRange"></ngx-slider-moby>
<ngx-slider-moby [max_value]="10" [min_value]="0" [range]="false" formControlName="kilogramms"></ngx-slider-moby>
</div>

NOTE: In case when you are using [range]="true" form control value will be as follows:

{from:20,to:55}

NOTE: If you want to use vertical slider specifying [vertical]="true" parent's height should be also specified otherwise component will behave unexpectedly.

Inputs

PropTypeDefaultDescription
min_valuenumber0minimal value for given slider
max_valuenumber500maximal value for given slider
value_fromnumber0If specified will assign provided value to the component value1 variable
value_tonumber0Similar with above but for value2 variable
showThumbLabelsbooleantruewhether or not to show labels on default slider(not range)
verticalbooleantrueIf false then the slider will appear horizontally
stepnumber1Allows to specify the number of units that one step has
rangebooleanfalseIf speified true then the slider will be a scope slider and have corresponding value and appearance(ex.: from 30 to 50). Thumblabels are visible by default in this type of slider
disabledbooleanfalseIf true then puts slider in a disabled state and doesn't handle any events on the element
direction'ltr' or 'rtl'ltrLeft to right or right to left(not implemeneted yet)
colorstringpurpleSlider will assume the corresponding color palette. Options: red,green,blue,purple,yellow

Events

valueChange - emits the object which looks like this in case of default slider {sliderId:string,value:number,percent:number},in case of range slider as follows:

{sliderId:string, value: {from:number,to:number}, percent: {from:number,to:number} }

blurred - blur event emits boolean true or false;

focused - focus event emits boolean true or false;

Update 2.0.0 info.

  1. Major bug fixes.
  2. Animation runs smoother.

Update 1.1.0 info.

  1. Added colors 'black','grey'.
  2. Added support of floating step.
  3. Fixed some bugs.
2.0.6

6 years ago

2.0.5

6 years ago

2.0.4

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.1.0

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago