Skip to content

Commit 121322b

Browse files
Fixing $timeout issue #14
Fixed #13
1 parent 6a47aef commit 121322b

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

ionic-range-slider.js

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44

55
angular.module("ion.rangeslider", []);
66

7-
angular.module("ion.rangeslider").directive("ionRangeSlider", [
8-
function () {
9-
7+
angular.module("ion.rangeslider").directive("ionRangeSlider",
8+
function($timeout) {
109
return {
1110
restrict: "E",
1211
scope: {
@@ -52,7 +51,7 @@ angular.module("ion.rangeslider").directive("ionRangeSlider", [
5251
onFinish: "&",
5352
},
5453
replace: true,
55-
link: function ($scope, $element, attrs, $timeout) {
54+
link: function($scope, $element, attrs) {
5655
$element.ionRangeSlider({
5756
min: $scope.min,
5857
max: $scope.max,
@@ -90,61 +89,63 @@ angular.module("ion.rangeslider").directive("ionRangeSlider", [
9089
valuesSeparator: $scope.values_separator,
9190
inputValuesSeparator: $scope.input_values_separator,
9291

93-
prettify: function (value) {
94-
if(!attrs.prettify) {
95-
return value;
96-
}
97-
return $scope.prettify({value: value});
92+
prettify: function(value) {
93+
if (!attrs.prettify) {
94+
return value;
95+
}
96+
return $scope.prettify({
97+
value: value
98+
});
9899
},
99-
onChange: function (a) {
100-
$scope.$apply(function () {
100+
onChange: function(a) {
101+
$scope.$apply(function() {
101102
$scope.from = a.from;
102103
$scope.to = a.to;
103104
$scope.onChange && $scope.onChange({
104105
a: a
105106
});
106107
});
107108
},
108-
onFinish: function () {
109+
onFinish: function() {
109110
$timeout(function() {
110111
$scope.$apply($scope.onFinish);
111112
});
112113
},
113114
});
114115
var watchers = [];
115-
watchers.push($scope.$watch("min", function (value) {
116+
watchers.push($scope.$watch("min", function(value) {
116117
$element.data("ionRangeSlider").update({
117118
min: value
118119
});
119120
}));
120-
watchers.push($scope.$watch('max', function (value) {
121+
watchers.push($scope.$watch('max', function(value) {
121122
$element.data("ionRangeSlider").update({
122123
max: value
123124
});
124125
}));
125-
watchers.push($scope.$watch('from', function (value) {
126+
watchers.push($scope.$watch('from', function(value) {
126127
var slider = $element.data("ionRangeSlider");
127128
if (slider.old_from !== value) {
128129
slider.update({
129130
from: value
130131
});
131132
}
132133
}));
133-
watchers.push($scope.$watch('to', function (value) {
134+
watchers.push($scope.$watch('to', function(value) {
134135
var slider = $element.data("ionRangeSlider");
135136
if (slider.old_to !== value) {
136137
slider.update({
137138
to: value
138139
});
139140
}
140141
}));
141-
watchers.push($scope.$watch('disable', function (value) {
142+
watchers.push($scope.$watch('disable', function(value) {
142143
$element.data("ionRangeSlider").update({
143144
disable: value
144145
});
145146
}));
146147
}
147-
}
148+
};
148149

149150
}
150-
])
151+
);

0 commit comments

Comments
 (0)