Skip to content

Commit

Permalink
Truly fix angular-slider#106. rz-slider-on-change fires before value …
Browse files Browse the repository at this point in the history
…is changed
  • Loading branch information
Valentin Hervieu committed Aug 25, 2015
1 parent 4f7b9f5 commit 9358261
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angularjs-slider",
"version": "0.1.26",
"version": "0.1.27",
"homepage": "https://github.com/rzajac/angularjs-slider",
"authors": [
"Rafal Zajac <rzajac@gmail.com>",
Expand Down
3 changes: 3 additions & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ <h1>AngularJS Touch Slider</h1>
<article>
<h2>Min/max slider example</h2>
Value: <pre>{{ slider_data | json }}</pre>
<p>Value linked on change: {{ otherData.value }}</p>

<rzslider
rz-slider-floor="0.5"
Expand Down Expand Up @@ -131,9 +132,11 @@ <h2>Draggable range example</h2>
};

$scope.slider_data = {value: 1};
$scope.otherData = {value: 10};

$scope.onChange = function() {
console.info('changed', $scope.slider_data.value);
$scope.otherData.value = $scope.slider_data.value * 10;
};
});
</script>
Expand Down
2 changes: 1 addition & 1 deletion dist/rzslider.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/rzslider.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jusas-angularjs-slider",
"version": "0.1.26",
"version": "0.1.27",
"description": "AngularJS slider directive with no external dependencies. Mobile friendly!.",
"main": "rzslider.js",
"repository": {
Expand Down
7 changes: 5 additions & 2 deletions rzslider.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* (c) Rafal Zajac <rzajac@gmail.com>
* http://github.com/rzajac/angularjs-slider
*
* Version: v0.1.21
* Version: v0.1.27
*
* Licensed under the MIT license
*/
Expand Down Expand Up @@ -596,7 +596,10 @@ function throttle(func, wait, options) {
*/
callOnChange: function() {
if(this.scope.rzSliderOnChange) {
this.scope.rzSliderOnChange();
var self = this;
$timeout(function() {
self.scope.rzSliderOnChange();
});
}
},

Expand Down

0 comments on commit 9358261

Please sign in to comment.