Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

I would like to use a slider (ionic range) to step through the strings in an array.

Here is a codepen to illustrate what I mean.

The issue where is that I am going to be mixing different ranges and arrays of values and strings depending on the item selected.

Here is and example of my ng-repeat which will iterate over the objects to display the range inputs.

  <div ng-repeat="paramObj in activeExercise.Params track by $index">
    <div class="item item-divider">
      {{paramObj.param}}: {{activeExercise.paramters.paramObj.childParam}}
    </div>
    <div class="item range">
      <i class="icon orange" ng-class="paramClass(paramObj.param)"></i>
      <input type="range" name="parameter" min="0" ng-model="paramObj.childParam"  max="100" value="0">
      <i class="icon"></i>
    </div>
  </div>

An example object is here:

  $scope.activeExercise = {
    "exerciseID": "442",
    "exerciseName": "4 Point Kneeling Lumbar Flexion",
    "Params": [{
      "childParam": "",
      "param": "Reps"
    }, {
      "childParam": "",
      "param": "Colour"
    }]
  }

  $scope.colourArray = [
    "Red",
    "Blue",
    "Red",
    "Yellow"
  ];

Question:

  1. Is it possible for a range slider to iterate through the string array rather than iterating through a range of numbers?

  2. I would need this to work conditionally depending on the value in the object (colours would be strings and reps / sets would be numbers.).

Expected behaviour:

An exercise can have several parameters (Reps, Sets, Weight, Colour). For parameters that utilise numbers then the range is ideal. However for the colour parameter, I need it to step through an array of strings rather than using numbers.

Many thanks for any help you may be able to offer.

share|improve this question
    
Not clear what objective is or what specific problem is – charlietfl 36 mins ago
    
Added my questions at the bottom, see edit. thanks. – Taylorsuk 34 mins ago
1  
You are still missing what the connection is between numbers produced in sliders and your data and what expected results are. Higher level objective is missing. "iterating strings" is meaningless without knowing what you are iterating them for – charlietfl 30 mins ago
    
I'm guessing you are driving at creating some filters but you need to define real filter criteria and relate that to your slider values. You keep staying stuck on "iterating strings" with no explanation of what iterations should do – charlietfl 12 mins ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.