Skip to content

Commit 9358261

Browse files
author
Valentin Hervieu
committed
Truly fix #106. rz-slider-on-change fires before value is changed
1 parent 4f7b9f5 commit 9358261

File tree

6 files changed

+13
-7
lines changed

6 files changed

+13
-7
lines changed

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angularjs-slider",
3-
"version": "0.1.26",
3+
"version": "0.1.27",
44
"homepage": "https://github.com/rzajac/angularjs-slider",
55
"authors": [
66
"Rafal Zajac <rzajac@gmail.com>",

demo/index.html

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ <h1>AngularJS Touch Slider</h1>
2020
<article>
2121
<h2>Min/max slider example</h2>
2222
Value: <pre>{{ slider_data | json }}</pre>
23+
<p>Value linked on change: {{ otherData.value }}</p>
2324

2425
<rzslider
2526
rz-slider-floor="0.5"
@@ -131,9 +132,11 @@ <h2>Draggable range example</h2>
131132
};
132133

133134
$scope.slider_data = {value: 1};
135+
$scope.otherData = {value: 10};
134136

135137
$scope.onChange = function() {
136138
console.info('changed', $scope.slider_data.value);
139+
$scope.otherData.value = $scope.slider_data.value * 10;
137140
};
138141
});
139142
</script>

dist/rzslider.min.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rzslider.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jusas-angularjs-slider",
3-
"version": "0.1.26",
3+
"version": "0.1.27",
44
"description": "AngularJS slider directive with no external dependencies. Mobile friendly!.",
55
"main": "rzslider.js",
66
"repository": {

rzslider.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* (c) Rafal Zajac <rzajac@gmail.com>
55
* http://github.com/rzajac/angularjs-slider
66
*
7-
* Version: v0.1.21
7+
* Version: v0.1.27
88
*
99
* Licensed under the MIT license
1010
*/
@@ -596,7 +596,10 @@ function throttle(func, wait, options) {
596596
*/
597597
callOnChange: function() {
598598
if(this.scope.rzSliderOnChange) {
599-
this.scope.rzSliderOnChange();
599+
var self = this;
600+
$timeout(function() {
601+
self.scope.rzSliderOnChange();
602+
});
600603
}
601604
},
602605

0 commit comments

Comments
 (0)