How to set time in call slider in angular js?

I am using Slider with a draggable range ( https://jsfiddle.net/ValentinH/954eve2L/ ) in angular js for timing. I want to set the time in this slider. So, my watch is from 00.00 to 24.00. But I want to set the time with an interval of 10 minutes, Like00.10, 00.20, 00.30, 00.40, 00.50, 01.00, 01.10,01.10

<article>
  <h2>Slider with draggable range</h2>

  <rzslider rz-slider-model="slider_draggable_range.minValue" rz-slider-high="slider_draggable_range.maxValue" rz-slider-options="slider_draggable_range.options"></rzslider>
</article>

// Slider with draggable range
$scope.slider_draggable_range = {
  minValue: 1,
  maxValue: 8,
  options: {
    ceil: 10,
    floor: 0,
    draggableRange: true
  }
};

$scope.slider_draggable_range = {
  minValue: $scope.fromTime,
  maxValue: $scope.toTime,
  options: {
    ceil: 24,
    floor: 0,
    draggableRange: true,
    showTicks: true,
    hideLimitLabels: true,
    hourBase: function(value) {
      return (((value > 1 && value < 12) || value > 25) ? '0' : '') + (value + 22) % 24 + '00 hrs'
    },
    steps: pules()
  }
};

I can not post my full code. Because it is impossible. I choose from time to time, like 10.00, 11.00, 12.00 ... But now I want time from 1.10, 1.20.1.30. enter image description here

When I used statically minValue: 4.40, then it will indicate 4, and when I set it 4.60, then it will point to 5, so convert it to the round value of the figure. Not in points.

$scope.slider_draggable_range = {
  minValue: 4.40,
  maxValue: 7,
  options: {
    ceil: 24,
    floor: 0,
    draggableRange: true
  }
};

ceil: 24 limit,
 : ,     minvalue:
,     maxvalue:

. .

+2
1

, , , stepsArray.

, . , .

( Slider with Alphabet http://angular-slider.imtqy.com/angularjs-slider/)

( ):

var app = angular.module('rzSliderDemo', ['rzModule', 'ui.bootstrap']);

app.controller('MainCtrl', function($scope, $rootScope, $timeout) {
  var arr = getRange().map(n => {
    return {
      value: n,
      legend: n
    };
  });
  
  $scope.slider = {
    minValue: '10.50',
    maxValue: '14.20',
    options: {
      showTicks: true,
      stepsArray: arr
    }
  };
});

function getRange() {
  var arr = [];
  var d = new Date(2017, 1, 1);
  for (var i = 0; i < (6 * 24); i++) {
    d.setMinutes(d.getMinutes() + 10);
    arr.push(leadZero(d.getHours()) + '.' + leadZero(d.getMinutes()));
  }
  return arr;
}

function leadZero(time) {
  return time < 10 ? '0' + time : time;
}
* {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Open Sans', sans-serif;
  color: #1f2636;
  font-size: 14px;
  padding-bottom: 40px;
}

header {
  background: #0db9f0;
  color: #fff;
  margin: -40px;
  margin-bottom: 40px;
  text-align: center;
  padding: 40px 0;
}

h1 {
  font-weight: 300;
}

h2 {
  margin-bottom: 10px;
}

.wrapper {
  background: #fff;
  padding: 40px;
}

article {
  margin-bottom: 10px;
}

.tab-pane {
  padding-top: 10px;
}

.field-title {
  width: 100px;
}

.vertical-sliders {
  margin: 0;
}

.vertical-sliders>div {
  height: 250px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://rawgit.com/rzajac/angularjs-slider/master/dist/rzslider.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.14.3/ui-bootstrap-tpls.js"></script>
<script src="https://rawgit.com/rzajac/angularjs-slider/master/dist/rzslider.js"></script>
<div ng-app="rzSliderDemo">
  <div ng-controller="MainCtrl" class="wrapper">
    <header>
      <h1>AngularJS Touch Slider</h1>

    </header>
    <article>
      <h2>Simple slider</h2>
      Model:
      <input type="text" ng-model="slider.minValue" />
      <input type="text" ng-model="slider.maxValue" />
      <br/>
      <rzslider rz-slider-model="slider.minValue" rz-slider-high="slider.maxValue" rz-slider-options="slider.options"></rzslider>
    </article>
  </div>
</div>
Hide result
+3

Source: https://habr.com/ru/post/1624562/


All Articles