|
1 | 1 | /*! angularjs-slider - v2.4.1 - |
2 | 2 | (c) Rafal Zajac <rzajac@gmail.com>, Valentin Hervieu <valentin@hervieu.me>, Jussi Saarivirta <jusasi@gmail.com>, Angelin Sirbu <angelin.sirbu@gmail.com> - |
3 | 3 | https://github.com/angular-slider/angularjs-slider - |
4 | | - 2016-01-22 */ |
| 4 | + 2016-01-24 */ |
5 | 5 | /*jslint unparam: true */ |
6 | 6 | /*global angular: false, console: false, define, module */ |
7 | 7 | (function(root, factory) { |
|
791 | 791 |
|
792 | 792 | /** |
793 | 793 | * Call the onStart callback if defined |
| 794 | + * The callback call is wrapped in a $evalAsync to ensure that its result will be applied to the scope. |
794 | 795 | * |
795 | 796 | * @returns {undefined} |
796 | 797 | */ |
797 | 798 | callOnStart: function() { |
798 | 799 | if (this.options.onStart) { |
799 | | - this.options.onStart(this.options.id); |
| 800 | + var self = this; |
| 801 | + this.scope.$evalAsync(function () { |
| 802 | + self.options.onStart(self.options.id, self.scope.rzSliderModel, self.scope.rzSliderHigh); |
| 803 | + }); |
800 | 804 | } |
801 | 805 | }, |
802 | 806 |
|
803 | 807 | /** |
804 | 808 | * Call the onChange callback if defined |
| 809 | + * The callback call is wrapped in a $evalAsync to ensure that its result will be applied to the scope. |
805 | 810 | * |
806 | 811 | * @returns {undefined} |
807 | 812 | */ |
808 | 813 | callOnChange: function() { |
809 | 814 | if (this.options.onChange) { |
810 | | - this.options.onChange(this.options.id); |
| 815 | + var self = this; |
| 816 | + this.scope.$evalAsync(function () { |
| 817 | + self.options.onChange(self.options.id, self.scope.rzSliderModel, self.scope.rzSliderHigh); |
| 818 | + }); |
811 | 819 | } |
812 | 820 | }, |
813 | 821 |
|
814 | 822 | /** |
815 | 823 | * Call the onEnd callback if defined |
| 824 | + * The callback call is wrapped in a $evalAsync to ensure that its result will be applied to the scope. |
816 | 825 | * |
817 | 826 | * @returns {undefined} |
818 | 827 | */ |
819 | 828 | callOnEnd: function() { |
820 | 829 | if (this.options.onEnd) { |
821 | 830 | var self = this; |
822 | | - $timeout(function() { |
823 | | - self.options.onEnd(self.options.id); |
| 831 | + this.scope.$evalAsync(function () { |
| 832 | + self.options.onEnd(self.options.id, self.scope.rzSliderModel, self.scope.rzSliderHigh); |
824 | 833 | }); |
825 | 834 | } |
826 | 835 | }, |
|
0 commit comments