Skip to content

Commit 4cb0132

Browse files
committed
refactor(stepsArray): Bind rzSliderModel and rzSliderHigh to the actual value (#335)
* refactor(stepsArray): Bind rzSliderModel and rzSliderHigh to the actual value As discussed in #328
1 parent f81bb67 commit 4cb0132

19 files changed

+533
-257
lines changed

CHANGELOG.md

+25
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
# 4.0.0 (2016-06-04)
2+
## Improvement
3+
- `stepsArray`: Bind rzSliderModel and rzSliderHigh to the actual value (#335).
4+
5+
## Breaking changes
6+
- From now on, when using the `stepsArray` feature, you should directly provide the actual value to rzSliderModel and rzSliderHigh instead of passing the index of this value.
7+
Thus, you need to update your config like in the following example:
8+
```js
9+
/* before 4.0 version */
10+
vm.slider = {
11+
value: 4, // index of the 'E' value in the array
12+
options: {
13+
stepsArray: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('')
14+
}
15+
}
16+
17+
/* from 4.0 version */
18+
vm.slider = {
19+
value: 'E',
20+
options: {
21+
stepsArray: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('')
22+
}
23+
}
24+
```
25+
126
# 3.0.0 (2016-06-02)
227
## Features
328
- Add IE8 support (#314).

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ $scope.slider = {
275275
**id** - _Any (defaults to null)_: If you want to use the same `translate` function for several sliders, just set the `id` to anything you want, and it will be passed to the `translate(value, sliderId)` function as a second argument.
276276

277277
**stepsArray** - _Array_: If you want to display a slider with non linear/number steps.
278-
Just pass an array with each slider value and that's it; the floor, ceil and step settings of the slider will be computed automatically. The `rz-slider-model` value will be the index of the selected item in the stepsArray.
278+
Just pass an array with each slider value and that's it; the floor, ceil and step settings of the slider will be computed automatically. The `rz-slider-model` and `rz-slider-high` values will be the value of the selected item in the stepsArray.
279279

280280
`stepsArray` can also be an array of objects like:
281281

demo/demo.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $modal) {
197197

198198
//Slider config with steps array of letters
199199
$scope.slider_alphabet = {
200-
value: 0,
200+
value: 'E',
201201
options: {
202202
stepsArray: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('')
203203
}
@@ -274,8 +274,6 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $modal) {
274274
$scope.slider_ticks_legend = {
275275
value: 5,
276276
options: {
277-
ceil: 10,
278-
floor: 0,
279277
showTicksValues: true,
280278
stepsArray: [
281279
{value: 1, legend: 'Very poor'},

demo/index.html

+4-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ <h2>Range slider</h2>
3030
Min Value: <input type="number" ng-model="rangeSlider.minValue"/><br/>
3131
Max Value: <input type="number" ng-model="rangeSlider.maxValue"/><br/>
3232
<rzslider
33-
rz-slider-model="rangeSlider.minValue"
34-
rz-slider-high="rangeSlider.maxValue"
35-
rz-slider-options="rangeSlider.options"
33+
data-rz-slider-model="rangeSlider.minValue"
34+
data-rz-slider-high="rangeSlider.maxValue"
35+
data-rz-slider-options="rangeSlider.options"
3636
></rzslider>
3737
</article>
3838

@@ -150,6 +150,7 @@ <h2>Slider with custom display function using html formatting</h2>
150150

151151
<article>
152152
<h2>Slider with Alphabet</h2>
153+
Current letter: {{ slider_alphabet.value }}
153154
<rzslider
154155
rz-slider-model="slider_alphabet.value"
155156
rz-slider-options="slider_alphabet.options"

dist/rzslider.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
/*! angularjs-slider - v3.0.0 -
1+
/*! angularjs-slider - v2.14.0 -
22
(c) Rafal Zajac <[email protected]>, Valentin Hervieu <[email protected]>, Jussi Saarivirta <[email protected]>, Angelin Sirbu <[email protected]> -
33
https://github.com/angular-slider/angularjs-slider -
4-
2016-06-02 */
4+
2016-05-25 */
55
.rzslider {
66
position: relative;
77
display: inline-block;

0 commit comments

Comments
 (0)