angular-bootstrap-slider icon indicating copy to clipboard operation
angular-bootstrap-slider copied to clipboard

Exception with the latest version

Open mastermind1981 opened this issue 9 years ago • 5 comments

Hi,

I updated for the last version to have the correction of the 2 way data binding, but i got an exception:


RangeError: toFixed() digits argument must be between 0 and 20
    at Number.toFixed (native)
    at Slider._applyToFixedAndParseFloat (http://localhost:3000/bower_components/seiyria-bootstrap-slider/js/bootstrap-slider.js:1305:28)
    at Slider._applyPrecision (http://localhost:3000/bower_components/seiyria-bootstrap-slider/js/bootstrap-slider.js:1297:17)
    at Slider.setValue (http://localhost:3000/bower_components/seiyria-bootstrap-slider/js/bootstrap-slider.js:732:30)
    at createNewSlider (http://localhost:3000/bower_components/seiyria-bootstrap-slider/js/bootstrap-slider.js:614:9)
    at new Slider (http://localhost:3000/bower_components/seiyria-bootstrap-slider/js/bootstrap-slider.js:301:20)
    at HTMLInputElement.<anonymous> (http://localhost:3000/bower_components/seiyria-bootstrap-slider/js/bootstrap-slider.js:152:25)
    at http://localhost:3000/bower_components/jquery/dist/jquery.js:144:20
    at Function.jQuery.extend.map (http://localhost:3000/bower_components/jquery/dist/jquery.js:467:13)
    at jQuery.fn.jQuery.map (http://localhost:3000/bower_components/jquery/dist/jquery.js:143:33)

Here is the markup:

 <slider ng-model="range.value" range="true" step="range.step" min="range.min" max="range.max" tooltip_split="true"></slider>

And here is the controller:

 $scope.range = {
        min: 10000,
        max: 1000000,
        step: 10000,
        value: []
      };
      $scope.delayedMin = parseInt($scope.allFilters.priceMin, 10);
      $scope.delayedMax = parseInt($scope.allFilters.priceMax, 10);
      $scope.range.value = [$scope.delayedMin,$scope.delayedMax] ;

mastermind1981 avatar Jun 06 '15 13:06 mastermind1981

Have you tried passing in the precision argument? Even if setting it to 0.

seiyria avatar Jun 06 '15 13:06 seiyria

it works but the 2 way databinding does not work

mastermind1981 avatar Jun 06 '15 13:06 mastermind1981

Ok, that's kinda strange. Would you mind investigating and making a small demo?

seiyria avatar Jun 06 '15 13:06 seiyria

Here is a plunker. I setted the model inside the controller but the slider doesn't seem to like it.

mastermind1981 avatar Jun 06 '15 14:06 mastermind1981

@mastermind1981 Here's a quickfix for you:

    $timeout(function() {
      $scope.exampleModel = [ 5 , 9];
    });

Make sure to inject $timeout.

bernardmoes avatar Jul 20 '15 07:07 bernardmoes