question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

StepsArray won't update Ceil and Floor.

See original GitHub issue

I’m changing the stepsArray dynamically after a http call, when I do so the floor and ceil slider values don’t change even though it says in the documentation that they should.

I cannot get the ceil and floor to change with stepsArray. Even if I specify it manually.

On HTTP Call, correct. screen shot 2015-12-06 at 1 43 43 pm

First drag, incorrect. screen shot 2015-12-06 at 1 43 51 pm

Back to the start, it’s reset. screen shot 2015-12-06 at 1 43 58 pm

I’m using:

<rzslider
    rz-slider-model="sliderMin"
    rz-slider-high="sliderMax"
    rz-slider-step-array="sliderSteps"
    rz-slider-options="slider.options">
</rzslider>
//Range Slider
    $scope.sliderSteps = [0, 1000]; //Default.
    $scope.sliderMax = $scope.sliderSteps[$scope.sliderSteps.length - 1];
    $scope.sliderMin = 0;
    $scope.slider = {
      options: {
        hideLimitLabels:false,
        translate: function(value) {
            return UserInfoService.getCurrencySymbol() + value; //TODO add currency multiplication here.
        }
      }
    };

....
....

//Set the steps after http call
var steps = 90;
var newSteps = [];
for (var i = 0; i < steps; i++) {
    newSteps.push(Math.round(min + ((max) * (i / steps))));
};
//Concat so angular updates as reference.
$scope.sliderSteps = [].concat(newSteps);
console.log($scope.sliderSteps);
console.log('min: ' + min + '| max: ' + max);

The console log results:

[129, 162, 196, 229, 262, 296, 329, 362, 396, 429, 462, 496, 529, 562, 596, 629, 662, 696, 729, 762, 796, 829, 862, 896, 929, 962, 996, 1029, 1062, 1096, 1129, 1162, 1196, 1229, 1262, 1296, 1329, 1362, 1396, 1429, 1462, 1496, 1529, 1562, 1596, 1629, 1662, 1696, 1729, 1762, 1796, 1829, 1862, 1896, 1929, 1962, 1996, 2029, 2062, 2096, 2129, 2162, 2196, 2229, 2262, 2296, 2329, 2362, 2396, 2429, 2462, 2496, 2529, 2562, 2596, 2629, 2662, 2696, 2729, 2762, 2796, 2829, 2862, 2896, 2929, 2962, 2996, 3029, 3062, 3096]
min: 129| max: 3000

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ollydixoncommented, Dec 6, 2015

Ok, so if you actually set the scoped vars of the ceil and floor from the html reference it doesn’t work. But if you set them directly in controller like so:

$scope.slider.options.floor = min;
$scope.slider.options.ceil = max;

It works. I still think that this is a bug, these are not being updated automatically.

0reactions
ollydixoncommented, Dec 6, 2015

Yeah if I put it in options it works thanks very much. 😃 (Keep up the great work)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Math.round and Math.ceil not working
Math.ceil() returns the ceiled value. It can't change the value of the variable it takes as argument, because Java passes arguments by value....
Read more >
AngularJS Slider
AngularJS slider directive with no external dependencies · Simple slider · Range slider · Slider with custom style · Range slider with min...
Read more >
Floor and Ceil from a BST
Given a binary search tree and a key(node) value, find the floor and ceil value for that particular key value. Floor Value Node:...
Read more >
angularjs-slider: Docs, Tutorials, Reviews
stepsArray - Array: If you want to display a slider with non linear/number steps. Just pass an array with each slider value and...
Read more >
Ceil - Amazon QuickSight
ceil rounds a decimal value to the next highest integer. For example, ceil(29.02) returns 30 . Syntax. ceil( decimal ). Arguments. decimal.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found