Skip to content
This repository has been archived by the owner on Jan 5, 2025. It is now read-only.

Commit

Permalink
bugfix for custom step
Browse files Browse the repository at this point in the history
  • Loading branch information
FDIM committed May 10, 2016
1 parent 5be1fdd commit 913ba17
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mdRangeSlider",
"main": "dist/md-range-slider.js",
"version": "1.0.1",
"version": "1.0.2",
"homepage": "https://github.com/FDIM/ng-md-range-slider.git",
"authors": [
"FDIM <domas.trijonis@gmail.com>"
Expand Down
7 changes: 5 additions & 2 deletions dist/md-range-slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
;(function(module) {
// source: https://gist.github.com/kuitos/89e8aa538f0a507bd682
module.controller('RangeSliderController', ['$scope', function($scope){
if(!$scope.step){
$scope.step = 1;
}
$scope.lowerMax = $scope.max - $scope.step;
$scope.upperMin = $scope.lowerValue + $scope.step;
if(!$scope.lowerValue || $scope.lowerValue<$scope.min){
Expand Down Expand Up @@ -38,10 +41,10 @@
template: [
'<div class="range-slider-container">',
'<div class="range-slider-left">',
'<md-slider aria-label="upperValue" ng-model="lowerValue" min="{{min}}" max="{{lowerMax}}"></md-slider>',
'<md-slider aria-label="upperValue" step="{{step}}" ng-model="lowerValue" min="{{min}}" max="{{lowerMax}}"></md-slider>',
'</div>',
'<div class="range-slider-right" ng-style="{width: upperWidth}">',
'<md-slider aria-label="upperValue" ng-model="upperValue" min="{{upperMin}}" max="{{max}}"></md-slider>',
'<md-slider aria-label="upperValue" step="{{step}}" ng-model="upperValue" min="{{upperMin}}" max="{{max}}"></md-slider>',
'</div>',
'</div>'
].join(''),
Expand Down
2 changes: 1 addition & 1 deletion dist/md-range-slider.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions example/index.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.0/angular.js" type="text/javascript"></script>
<script src="../bower_components/angular-animate/angular-animate.min.js"></script>
<script src="../bower_components/angular-aria/angular-aria.min.js"></script>
<script src="../bower_components/angular-material/angular-material.min.js"></script>
<script src="../bower_components/angular-animate/angular-animate.js"></script>
<script src="../bower_components/angular-aria/angular-aria.js"></script>
<script src="../bower_components/angular-material/angular-material.js"></script>
<script src="../dist/md-range-slider.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="../bower_components/angular-material/angular-material.css">
<link rel="stylesheet" type="text/css" href="../dist/style.css">
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mdRangeSlider",
"version": "1.0.1",
"version": "1.0.2",
"main": "dist/md-range-slider.js",
"scripts": {
"test": "gulp coverage"
Expand Down
7 changes: 5 additions & 2 deletions src/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
;(function(module) {
// source: https://gist.github.com/kuitos/89e8aa538f0a507bd682
module.controller('RangeSliderController', ['$scope', function($scope){
if(!$scope.step){
$scope.step = 1;
}
$scope.lowerMax = $scope.max - $scope.step;
$scope.upperMin = $scope.lowerValue + $scope.step;
if(!$scope.lowerValue || $scope.lowerValue<$scope.min){
Expand Down Expand Up @@ -38,10 +41,10 @@
template: [
'<div class="range-slider-container">',
'<div class="range-slider-left">',
'<md-slider aria-label="upperValue" ng-model="lowerValue" min="{{min}}" max="{{lowerMax}}"></md-slider>',
'<md-slider aria-label="upperValue" step="{{step}}" ng-model="lowerValue" min="{{min}}" max="{{lowerMax}}"></md-slider>',
'</div>',
'<div class="range-slider-right" ng-style="{width: upperWidth}">',
'<md-slider aria-label="upperValue" ng-model="upperValue" min="{{upperMin}}" max="{{max}}"></md-slider>',
'<md-slider aria-label="upperValue" step="{{step}}" ng-model="upperValue" min="{{upperMin}}" max="{{max}}"></md-slider>',
'</div>',
'</div>'
].join(''),
Expand Down

0 comments on commit 913ba17

Please sign in to comment.