Skip to content

Commit 2224d10

Browse files
JulioCgeoffreybauduin
authored andcommitted
Fix missing and non-working parameters (#8)
* Fix prettify argument not being executed range.slider's `prettify` param is a function that allows the user to customize the displayed values on the slider. Currently, it's not being executed, since it's bound as a plain value. * Added missing parameters from range.slider
1 parent 384da6b commit 2224d10

File tree

1 file changed

+73
-23
lines changed

1 file changed

+73
-23
lines changed

ionic-range-slider.js

Lines changed: 73 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,46 +6,96 @@ angular.module("ion.rangeslider", []);
66

77
angular.module("ion.rangeslider").directive("ionRangeSlider", [
88
function () {
9-
9+
1010
return {
1111
restrict: "E",
1212
scope: {
1313
min: "=",
1414
max: "=",
15+
from: "=",
16+
to: "=",
17+
disable: "=",
18+
1519
type: "@",
16-
prefix: "@",
17-
maxPostfix: "@",
18-
prettify: "@",
20+
step: "@",
21+
minInterval: "@",
22+
maxInterval: "@",
23+
dragInterval: "@",
24+
values: "@",
25+
fromFixed: "@",
26+
fromMin: "@",
27+
fromMax: "@",
28+
fromShadow: "@",
29+
toFixed: "@",
30+
toMax: "@",
31+
toShadow: "@",
32+
prettifyEnabled: "@",
33+
prettifySeparator: "@",
34+
forceEdges: "@",
35+
keyboard: "@",
36+
keyboardStep: "@",
1937
grid: "@",
2038
gridMargin: "@",
21-
postfix: "@",
22-
step: "@",
39+
gridNum: "@",
40+
gridSnap: "@",
2341
hideMinMax: "@",
2442
hideFromTo: "@",
25-
from: "=",
26-
to: "=",
27-
disable: "=",
43+
prefix: "@",
44+
postfix: "@",
45+
maxPostfix: "@",
46+
decorateBoth: "@",
47+
valuesSeparator: "@",
48+
inputValuesSeparator: "@",
49+
50+
prettify: "&",
2851
onChange: "&",
29-
onFinish: "&"
52+
onFinish: "&",
3053
},
3154
replace: true,
32-
link: function ($scope, $element) {
55+
link: function ($scope, $element, attrs) {
3356
$element.ionRangeSlider({
3457
min: $scope.min,
3558
max: $scope.max,
36-
type: $scope.type,
37-
prefix: $scope.prefix,
38-
maxPostfix: $scope.maxPostfix,
39-
prettify: $scope.prettify,
40-
grid: $scope.grid,
41-
gridMargin: $scope.gridMargin,
42-
postfix: $scope.postfix,
43-
step: $scope.step,
44-
hideMinMax: $scope.hideMinMax,
45-
hideFromTo: $scope.hideFromTo,
4659
from: $scope.from,
4760
to: $scope.to,
4861
disable: $scope.disable,
62+
type: $scope.type,
63+
step: $scope.step,
64+
minInterval: $scope.min_interval,
65+
maxInterval: $scope.max_interval,
66+
dragInterval: $scope.drag_interval,
67+
values: $scope.values,
68+
fromFixed: $scope.from_fixed,
69+
fromMin: $scope.from_min,
70+
fromMax: $scope.from_max,
71+
fromShadow: $scope.from_shadow,
72+
toFixed: $scope.to_fixed,
73+
toMax: $scope.to_max,
74+
toShadow: $scope.to_shadow,
75+
prettifyEnabled: $scope.prettify_enabled,
76+
prettifySeparator: $scope.prettify_separator,
77+
forceEdges: $scope.force_edges,
78+
keyboard: $scope.keyboard,
79+
keyboardStep: $scope.keyboard_step,
80+
grid: $scope.grid,
81+
gridMargin: $scope.grid_margin,
82+
gridNum: $scope.grid_num,
83+
gridSnap: $scope.grid_snap,
84+
hideMinMax: $scope.hide_min_max,
85+
hideFromTo: $scope.hide_from_to,
86+
prefix: $scope.prefix,
87+
postfix: $scope.postfix,
88+
maxPostfix: $scope.max_postfix,
89+
decorateBoth: $scope.decorate_both,
90+
valuesSeparator: $scope.values_separator,
91+
inputValuesSeparator: $scope.input_values_separator,
92+
93+
prettify: function (value) {
94+
if(!attrs.prettify) {
95+
return value;
96+
}
97+
return $scope.prettify({value: value});
98+
},
4999
onChange: function (a) {
50100
$scope.$apply(function () {
51101
$scope.from = a.from;
@@ -57,7 +107,7 @@ angular.module("ion.rangeslider").directive("ionRangeSlider", [
57107
},
58108
onFinish: function () {
59109
$scope.$apply($scope.onFinish);
60-
}
110+
},
61111
});
62112
var watchers = [];
63113
watchers.push($scope.$watch("min", function (value) {
@@ -93,6 +143,6 @@ angular.module("ion.rangeslider").directive("ionRangeSlider", [
93143
}));
94144
}
95145
}
96-
146+
97147
}
98148
])

0 commit comments

Comments
 (0)