├── .bowerrc ├── .gitignore ├── LICENSE ├── README.md ├── bower.json ├── examples ├── app.js ├── basic │ ├── basic.html │ └── basic.js ├── destroy │ ├── destroy.html │ └── destroy.js ├── disable │ ├── disable.html │ └── disable.js ├── events │ ├── events.html │ └── events.js ├── index.html ├── multiple-sliders-binding │ ├── multiple-sliders-binding.html │ └── multiple-sliders-binding.js ├── options │ ├── options.html │ └── options.js ├── slide-debounce │ ├── slide-debounce.html │ └── slide-debounce.js ├── timeout │ ├── timeout.html │ └── timeout.js ├── tooltips │ ├── tooltips.html │ └── tooltips.js └── updating-slider-options │ ├── updating-slider-options.html │ └── updating-slider-options.js ├── nouislider.js ├── nouislider.min.js ├── package.json └── yarn.lock /.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory" : "bower_components" 3 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | node_modules 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Andrey Yankovsky 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # nouislider-angular 2 | 3 | Check demo at http://yankovsky.github.io/nouislider-angular/examples 4 | 5 | Updated for New NoUISlider versions 6 | 7 | You can pass any [nouislider options](http://refreshless.com/nouislider/slider-options/) options to ya-no-ui-slider directive. 8 | 9 | ## Installation 10 | 11 | #### Install with NPM 12 | 13 | ``` 14 | npm install nouislider-angular 15 | ``` 16 | 17 | #### Install with Bower 18 | 19 | ``` 20 | bower install nouislider-angular 21 | ``` 22 | 23 | ## Dependencies 24 | 25 | For this directive to work you need to include angular and [nouislider](https://github.com/leongersen/noUiSlider) js first. Check [example](https://github.com/Yankovsky/nouislider-angular/blob/master/examples/index.html) to see how it is done. 26 | 27 | ## Basic usage 28 | 29 | ```javascript 30 | angular.module('sampleApp', ['ya.nouislider']) 31 | .controller('SampleCtrl', function($scope) { 32 | $scope.options = { 33 | start: [20, 70], 34 | range: {min: 0, max: 100} 35 | } 36 | }) 37 | ``` 38 | ```html 39 |
40 | ``` 41 | 42 | ## Options 43 | 44 | #### Global config 45 | 46 | You can set global configuration value yaNoUiSliderConfig and all nouislider options will inherit from it: 47 | 48 | ```javascript 49 | angular.module('sampleApp', ['ya.nouislider']) 50 | .value('yaNoUiSliderConfig', {step: 1}) 51 | ``` 52 | 53 | #### Event handlers 54 | 55 | ```javascript 56 | $scope.eventHandlers = { 57 | update: function(values, handle, unencoded) {}, 58 | slide: function(values, handle, unencoded) {}, 59 | set: function(values, handle, unencoded) {}, 60 | change: function(values, handle, unencoded) {} 61 | } 62 | ``` 63 | ```html 64 |
66 | ``` 67 | 68 | #### Disable slider or individual handlers 69 | 70 | ```html 71 |
75 | ``` 76 | 77 | #### Slide event debounce 78 | 79 | Use number to specify delay in ms or use special value "Infinity" to disable updating model on slide event. 80 | 81 | ```html 82 |
84 | 85 |
87 | ``` 88 | 89 | ## Development 90 | 91 | For development use examples/index.html file and some local web server. 92 | 93 | ## Building minified version 94 | 95 | To build minified version use `npm run build` command. 96 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nouislider-angular", 3 | "main": "nouislider.js", 4 | "homepage": "https://github.com/Yankovsky/nouislider-angular#readme", 5 | "authors": [ 6 | "Yankovsky " 7 | ], 8 | "description": "Angular wrapper for nouislider", 9 | "keywords": [ 10 | "nouislider", 11 | "slider", 12 | "angular", 13 | "angularjs" 14 | ], 15 | "license": "ISC", 16 | "ignore": [ 17 | "**/*", 18 | "!nouislider.js", 19 | "!nouislider.min.js" 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /examples/app.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | angular.module('exampleApp', ['ya.nouislider', 'ngRoute']).config(function($routeProvider) { 4 | $routeProvider 5 | .when('/', { 6 | templateUrl: 'basic/basic.html', 7 | controller: 'BasicCtrl', 8 | controllerAs: 'ctrl' 9 | }) 10 | .when('/options', { 11 | templateUrl: 'options/options.html', 12 | controller: 'OptionsCtrl', 13 | controllerAs: 'ctrl' 14 | }) 15 | .when('/events', { 16 | templateUrl: 'events/events.html', 17 | controller: 'EventsCtrl', 18 | controllerAs: 'ctrl' 19 | }) 20 | .when('/disable', { 21 | templateUrl: 'disable/disable.html', 22 | controller: 'DisablingSliderCtrl', 23 | controllerAs: 'ctrl' 24 | }) 25 | .when('/slide-debounce', { 26 | templateUrl: 'slide-debounce/slide-debounce.html', 27 | controller: 'SlideDebounceCtrl', 28 | controllerAs: 'ctrl' 29 | }) 30 | .when('/updating-slider-options', { 31 | templateUrl: 'updating-slider-options/updating-slider-options.html', 32 | controller: 'UpdatingSliderOptionsCtrl', 33 | controllerAs: 'ctrl' 34 | }) 35 | .when('/timeout', { 36 | templateUrl: 'timeout/timeout.html', 37 | controller: 'TimeoutCtrl', 38 | controllerAs: 'ctrl' 39 | }) 40 | .when('/tooltips', { 41 | templateUrl: 'tooltips/tooltips.html', 42 | controller: 'TooltipsCtrl', 43 | controllerAs: 'ctrl' 44 | }) 45 | .when('/destroy', { 46 | templateUrl: 'destroy/destroy.html', 47 | controller: 'DestroyCtrl', 48 | controllerAs: 'ctrl' 49 | }) 50 | .when('/multiple-sliders-binding', { 51 | templateUrl: 'multiple-sliders-binding/multiple-sliders-binding.html', 52 | controller: 'MultipleSlidersBindingCtrl', 53 | controllerAs: 'ctrl' 54 | }); 55 | }).value('noUiSliderConfig', { 56 | step: 1 57 | }) 58 | -------------------------------------------------------------------------------- /examples/basic/basic.html: -------------------------------------------------------------------------------- 1 |
2 |

Basic

3 | 4 |

One handle

5 | 6 |
8 | 9 | 10 |

Two handles

11 | 12 | 13 |
15 | 16 |
-------------------------------------------------------------------------------- /examples/basic/basic.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | angular.module('exampleApp').controller('BasicCtrl', function() { 4 | var that = this; 5 | that.options1 = { 6 | start: 30, 7 | connect: 'lower', 8 | step: 1, 9 | range: { 10 | min: 0, 11 | max: 100 12 | } 13 | }; 14 | 15 | that.options2 = { 16 | start: [30, 90], 17 | connect: true, 18 | step: 1, 19 | range: { 20 | min: 0, 21 | max: 100 22 | } 23 | }; 24 | }) -------------------------------------------------------------------------------- /examples/destroy/destroy.html: -------------------------------------------------------------------------------- 1 |
2 |

Destroy

3 | 4 | 5 |
{{ctrl.options.start}}
6 |
9 |
-------------------------------------------------------------------------------- /examples/destroy/destroy.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | angular.module('exampleApp').controller('DestroyCtrl', function() { 4 | var that = this; 5 | that.options = { 6 | start: 15, 7 | range: { 8 | min: 0, 9 | max: 20 10 | } 11 | }; 12 | that.shown = true; 13 | }); -------------------------------------------------------------------------------- /examples/disable/disable.html: -------------------------------------------------------------------------------- 1 |
2 |

Disabling a slider

3 | 4 |
{{ctrl.options1.start}}
5 |
10 | 11 |
{{ctrl.options2.start}}
12 |
17 | 18 | 22 | 26 | 30 | 31 |

Slider disabled by default

32 | 33 |
{{ctrl.options3.start}}
34 |
37 | 38 | 42 |
-------------------------------------------------------------------------------- /examples/disable/disable.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | angular.module('exampleApp').controller('DisablingSliderCtrl', function() { 4 | var that = this; 5 | that.options1 = { 6 | start: 20, 7 | connect: 'lower', 8 | range: { 9 | min: 0, 10 | max: 40 11 | } 12 | }; 13 | that.options2 = { 14 | start: [20, 30], 15 | connect: true, 16 | range: { 17 | min: 0, 18 | max: 40 19 | } 20 | }; 21 | that.sliderDisabled = false; 22 | that.sliderHandle1Disabled = false; 23 | that.sliderHandle2Disabled = false; 24 | 25 | that.options3 = { 26 | start: [10, 50], 27 | connect: true, 28 | range: { 29 | min: 0, 30 | max: 100 31 | } 32 | }; 33 | that.slider3Disabled = true; 34 | }); -------------------------------------------------------------------------------- /examples/events/events.html: -------------------------------------------------------------------------------- 1 |
2 |

Events

3 | 4 |
6 | {{eventName}} 7 |
8 | 9 |
{{ctrl.options.start}}
10 |
13 | 14 | 15 | 16 |
-------------------------------------------------------------------------------- /examples/events/events.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | angular.module('exampleApp').controller('EventsCtrl', function($timeout) { 4 | function addLogEntry(eventName) { 5 | that.highlighted[eventName] = true 6 | $timeout(function() { 7 | that.highlighted[eventName] = false; 8 | }, 450); 9 | } 10 | 11 | var that = this; 12 | that.options = { 13 | start: [5, 10], 14 | connect: true, 15 | range: { 16 | min: 0, 17 | max: 20 18 | } 19 | }; 20 | that.events = { 21 | update: addLogEntry.bind(undefined, 'update'), 22 | slide: addLogEntry.bind(undefined, 'slide'), 23 | set: addLogEntry.bind(undefined, 'set'), 24 | change: addLogEntry.bind(undefined, 'change') 25 | }; 26 | that.highlighted = {}; 27 | }); 28 | -------------------------------------------------------------------------------- /examples/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | nouislider-angular examples 5 | 6 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | Basic | 65 | Options | 66 | Events | 67 | Disable | 68 | Slide debounce | 69 | Updating slider options | 70 | Timeout | 71 | Tooltips | 72 | Destroy | 73 | Multiple sliders binding 74 | 75 |
76 | 77 | 78 | -------------------------------------------------------------------------------- /examples/multiple-sliders-binding/multiple-sliders-binding.html: -------------------------------------------------------------------------------- 1 |
2 |

Multiple sliders binding

3 | 4 | Linked issues/resources: 5 | 13 | 14 | 15 | 16 |
{{ctrl.numbers}}
17 | 18 |
19 |
21 | 22 |
23 |
-------------------------------------------------------------------------------- /examples/multiple-sliders-binding/multiple-sliders-binding.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | angular.module('exampleApp').controller('MultipleSlidersBindingCtrl', function($scope) { 4 | var that = this; 5 | 6 | var commonOptions = { 7 | connect: 'lower', 8 | step: 1, 9 | range: { 10 | min: 0, 11 | max: 20 12 | } 13 | }; 14 | 15 | 16 | that.rand = function() { 17 | return Math.floor(Math.random() * 21); 18 | }; 19 | 20 | that.numbers = [5, 10, 15]; 21 | 22 | that.slidersOptions = []; 23 | 24 | that.addSlider = function(number) { 25 | var options = angular.copy(commonOptions); 26 | options.start = number; 27 | 28 | that.slidersOptions.push(options); 29 | }; 30 | 31 | that.removeSlider = function(index) { 32 | that.slidersOptions.splice(index, 1); 33 | }; 34 | 35 | that.numbers.forEach(function(number) { 36 | that.addSlider(number); 37 | }); 38 | 39 | $scope.$watchCollection(function() { 40 | return that.slidersOptions.map(function(options) { 41 | return options.start; 42 | }) 43 | }, function(newValue) { 44 | that.numbers = newValue; 45 | }); 46 | }); -------------------------------------------------------------------------------- /examples/options/options.html: -------------------------------------------------------------------------------- 1 | 2 | <div ya-no-ui-slider="Object (any usual noUiSlider options goes here)" 3 | ya-no-ui-slider-disabled="Boolean" 4 | ya-no-ui-slider-handle1-disabled="Boolean" 5 | ya-no-ui-slider-handle2-disabled="Boolean" 6 | ya-no-ui-slider-events="Object (event name to single handler function)" 7 | ya-no-ui-slider-slide-debounce="Number || Infinity (use Infinity for disabling change on slide event)"></div> 8 | 9 | 10 | Example: 11 | 12 | $scope.options = { 13 | start: [20, 80], 14 | step: 10, 15 | margin: 20, 16 | connect: true, 17 | direction: 'rtl', 18 | orientation: 'vertical', 19 | behaviour: 'tap-drag', 20 | range: { 'min': 0, 'max': 100 }, 21 | pips: { mode: 'steps', density: 2 } 22 | } 23 | <div ya-no-ui-slider="options"></div> 24 | 25 | 26 |
27 |
29 | 30 | 31 | 32 |
33 | -------------------------------------------------------------------------------- /examples/options/options.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | angular.module('exampleApp').controller('OptionsCtrl', function() { 4 | var that = this; 5 | that.options = { 6 | start: [20, 80], 7 | step: 10, 8 | margin: 20, 9 | connect: true, 10 | direction: 'rtl', 11 | orientation: 'vertical', 12 | behaviour: 'tap-drag', 13 | range: {'min': 0, 'max': 100}, 14 | pips: {mode: 'steps', density: 2} 15 | } 16 | }); -------------------------------------------------------------------------------- /examples/slide-debounce/slide-debounce.html: -------------------------------------------------------------------------------- 1 |
2 |

debounce

3 | 4 |

ya-no-ui-slider-slide-debounce="Infinity"

5 |
Model doesn't change on slide
6 |
{{ctrl.options1.start}}
7 |
10 | 11 |

ya-no-ui-slider-slide-debounce="300"

12 |
Try to drag and hold the handle
13 |
{{ctrl.options2.start}}
14 |
17 |
18 | -------------------------------------------------------------------------------- /examples/slide-debounce/slide-debounce.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | angular.module('exampleApp').controller('SlideDebounceCtrl', function() { 4 | var that = this; 5 | that.options1 = { 6 | start: 15, 7 | range: { 8 | min: 0, 9 | max: 20 10 | } 11 | }; 12 | that.options2 = { 13 | start: 5, 14 | range: { 15 | min: 0, 16 | max: 20 17 | } 18 | }; 19 | that.options3 = { 20 | start: 10, 21 | range: { 22 | min: 0, 23 | max: 20 24 | } 25 | }; 26 | }); -------------------------------------------------------------------------------- /examples/timeout/timeout.html: -------------------------------------------------------------------------------- 1 |
2 |

Timeout

3 | 4 |

Value

5 | 6 | 7 |
9 |
10 | 11 | -------------------------------------------------------------------------------- /examples/timeout/timeout.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | angular.module('exampleApp').controller('TimeoutCtrl', function($timeout) { 4 | var that = this; 5 | 6 | $timeout(function() { 7 | that.options = { 8 | start: [30, 90], 9 | connect: true, 10 | step: 1, 11 | range: { 12 | min: 0, 13 | max: 100 14 | } 15 | }; 16 | }, 1000); 17 | }) -------------------------------------------------------------------------------- /examples/tooltips/tooltips.html: -------------------------------------------------------------------------------- 1 |
3 | -------------------------------------------------------------------------------- /examples/tooltips/tooltips.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | angular.module('exampleApp').controller('TooltipsCtrl', function() { 4 | var that = this; 5 | that.options = { 6 | start: [20, 80], 7 | connect: true, 8 | range: {'min': 0, 'max': 100}, 9 | tooltips: true 10 | } 11 | }); 12 | -------------------------------------------------------------------------------- /examples/updating-slider-options/updating-slider-options.html: -------------------------------------------------------------------------------- 1 |
2 |

Updating slider options

3 | 4 |
{{ctrl.options.start}}
5 | 6 |
7 | 10 | 11 | 14 |
15 | 16 |
18 | 19 |
-------------------------------------------------------------------------------- /examples/updating-slider-options/updating-slider-options.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | angular.module('exampleApp').controller('UpdatingSliderOptionsCtrl', function() { 4 | var that = this; 5 | that.options = { 6 | start: 30, 7 | range: { 8 | min: 0, 9 | max: 40 10 | }, 11 | pips: { mode: 'steps', density: 2 } 12 | }; 13 | that.setRange = function(min, max) { 14 | that.options.range = { 15 | min: min, 16 | max: max 17 | } 18 | } 19 | }) -------------------------------------------------------------------------------- /nouislider.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | angular.module('ya.nouislider', []) 4 | .value('yaNoUiSliderConfig', {}) 5 | .directive('yaNoUiSlider', ['$timeout', '$log', 'yaNoUiSliderConfig', function($timeout, $log, yaNoUiSliderConfig) { 6 | function toArray(val) { 7 | return angular.isArray(val) ? val : [val]; 8 | } 9 | 10 | function copy(val) { 11 | return toArray(val).slice(); 12 | } 13 | 14 | function equals(a, b) { 15 | a = toArray(a); 16 | b = toArray(b); 17 | 18 | return a[0] === b[0] && a[1] === b[1]; 19 | } 20 | 21 | function omit(object, property) { 22 | var keys = Object.keys(object), 23 | index = -1, 24 | length = keys.length, 25 | result = {}; 26 | 27 | while (++index < length) { 28 | var key = keys[index]; 29 | if (key !== property) { 30 | result[key] = object[key]; 31 | } 32 | } 33 | return result; 34 | } 35 | 36 | return { 37 | restrict: 'A', 38 | require: 'yaNoUiSlider', 39 | scope: { 40 | yaNoUiSlider: '=', 41 | yaNoUiSliderDisabled: '=', 42 | yaNoUiSliderHandle1Disabled: '=', 43 | yaNoUiSliderHandle2Disabled: '=', 44 | yaNoUiSliderSlideDebounce: '@' 45 | }, 46 | controller: ['$scope', '$element', '$attrs', function($scope, $element, $attrs) { 47 | var that = this, 48 | noUiSliderElement = $element[0], 49 | noUiSliderEvents = $scope.$parent.$eval($attrs.yaNoUiSliderEvents), 50 | slideDebounceDelay = $scope.yaNoUiSliderSlideDebounce || 0, 51 | events = slideDebounceDelay && slideDebounceDelay === 'Infinity' ? ['change'] : ['change', 'slide'], 52 | noUiSliderInstance, 53 | origins, 54 | sliderScope, 55 | pendingSlideDebounce; 56 | 57 | // allow to get noUiSlider instance from outside of that directive 58 | that.getNoUiSlider = function() { 59 | return noUiSliderInstance; 60 | }; 61 | 62 | function toggleDisabled(element, newValue, oldValue) { 63 | if (newValue) { 64 | element.setAttribute('disabled', true); 65 | } else { 66 | element.removeAttribute('disabled'); 67 | } 68 | } 69 | 70 | function destroy() { 71 | sliderScope.$destroy(); 72 | noUiSliderInstance.off('slide change update slide'); 73 | noUiSliderInstance.destroy(); 74 | $timeout.cancel(pendingSlideDebounce); 75 | } 76 | 77 | function createSlider() { 78 | function updateValue(newValue) { 79 | var newValueCopy = copy(newValue); 80 | if (!equals(newValueCopy, latestValue)) { 81 | latestValue = newValueCopy; 82 | $scope.$applyAsync(function() { 83 | if (angular.isArray(newValue)) { 84 | if (angular.isArray($scope.yaNoUiSlider.start)) { 85 | $scope.yaNoUiSlider.start[0] = newValue[0]; 86 | $scope.yaNoUiSlider.start[1] = newValue[1]; 87 | } else { 88 | $scope.yaNoUiSlider.start = newValue[0]; 89 | } 90 | } else { 91 | $scope.yaNoUiSlider.start = newValue; 92 | } 93 | }); 94 | } 95 | } 96 | 97 | sliderScope = $scope.$new(); 98 | var options = angular.extend({}, yaNoUiSliderConfig, $scope.yaNoUiSlider); 99 | var latestValue = copy(options.start); 100 | options.start = copy(options.start); 101 | noUiSlider.create(noUiSliderElement, options); 102 | origins = noUiSliderElement.getElementsByClassName('noUi-origin'); 103 | noUiSliderInstance = noUiSliderElement.noUiSlider; 104 | 105 | sliderScope.$watch(function() { 106 | var modelValue = $scope.yaNoUiSlider.start; 107 | if (!equals(modelValue, latestValue)) { 108 | latestValue = copy(modelValue); 109 | noUiSliderInstance.set(copy(modelValue)); 110 | } 111 | return latestValue; 112 | }); 113 | 114 | angular.forEach(events, function(eventName) { 115 | noUiSliderInstance.on(eventName + '.internal', function(values, handle, unencoded) { 116 | if (eventName === 'slide' && slideDebounceDelay) { 117 | $timeout.cancel(pendingSlideDebounce); 118 | pendingSlideDebounce = $timeout(function() { 119 | updateValue(unencoded); 120 | }, slideDebounceDelay); 121 | } else { 122 | updateValue(unencoded); 123 | } 124 | }); 125 | }); 126 | 127 | angular.forEach(noUiSliderEvents, function (handler, event) { 128 | noUiSliderInstance.on(event + '.noUiSlider', function () { 129 | var handlerArguments = Array.prototype.slice.call(arguments); 130 | var self = this; 131 | $scope.$applyAsync(function () { 132 | handler.apply(self, handlerArguments); 133 | }); 134 | }); 135 | }); 136 | 137 | sliderScope.$watch('yaNoUiSliderDisabled', toggleDisabled.bind(undefined, noUiSliderElement)); 138 | sliderScope.$watch('yaNoUiSliderHandle1Disabled', toggleDisabled.bind(undefined, origins[0])); 139 | sliderScope.$watch('yaNoUiSliderHandle2Disabled', function(newValue, oldValue) { 140 | if (newValue && !origins[1]) { 141 | return $log.warn('Warning: attempt to toggle disabled state of second handle using ya-no-ui-slider-handle2-disabled attribute in one-handle slider, nouislider-angular is ignoring such call.'); 142 | } 143 | if (origins[1]) { 144 | toggleDisabled(origins[1], newValue, oldValue); 145 | } 146 | }); 147 | } 148 | 149 | function initialize() { 150 | $scope.$watch(function() { 151 | return omit($scope.yaNoUiSlider, 'start'); 152 | }, function() { 153 | if (noUiSliderInstance) { 154 | destroy(); 155 | } 156 | createSlider(); 157 | }, true); 158 | 159 | $scope.$on('$destroy', destroy); 160 | } 161 | 162 | var initializeWatcher = $scope.$watch('yaNoUiSlider', function(options) { 163 | if (options) { 164 | initializeWatcher(); 165 | initialize(); 166 | } 167 | }); 168 | }] 169 | } 170 | }]); 171 | -------------------------------------------------------------------------------- /nouislider.min.js: -------------------------------------------------------------------------------- 1 | "use strict";angular.module("ya.nouislider",[]).value("yaNoUiSliderConfig",{}).directive("yaNoUiSlider",["$timeout","$log","yaNoUiSliderConfig",function(i,e,n){function a(i){return angular.isArray(i)?i:[i]}function r(i){return a(i).slice()}function t(i,e){return i=a(i),e=a(e),i[0]===e[0]&&i[1]===e[1]}function o(i,e){for(var n=Object.keys(i),a=-1,r=n.length,t={};++a", 25 | "license": "ISC", 26 | "bugs": { 27 | "url": "https://github.com/Yankovsky/nouislider-angular/issues" 28 | }, 29 | "homepage": "https://github.com/Yankovsky/nouislider-angular#readme", 30 | "dependencies": { 31 | "angular": "^1.7.8", 32 | "nouislider": "^13.1.5" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | align-text@^0.1.1, align-text@^0.1.3: 6 | version "0.1.4" 7 | resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117" 8 | integrity sha1-DNkKVhCT810KmSVsIrcGlDP60Rc= 9 | dependencies: 10 | kind-of "^3.0.2" 11 | longest "^1.0.1" 12 | repeat-string "^1.5.2" 13 | 14 | angular-route@^1.7.8: 15 | version "1.7.8" 16 | resolved "https://registry.yarnpkg.com/angular-route/-/angular-route-1.7.8.tgz#d502aa605dcbb253a93e844c0adf51c9bc36b9fa" 17 | integrity sha512-VVk89PH0fsY5kfbx+N7IVX1IwnaPWYhMGY0uA+rjej2v1sjvrTx1SLkxUK4E0UpW1hXeLJhN7ncBcwoBiPtAtA== 18 | 19 | angular@^1.7.8: 20 | version "1.7.8" 21 | resolved "https://registry.yarnpkg.com/angular/-/angular-1.7.8.tgz#b77ede272ce1b261e3be30c1451a0b346905a3c9" 22 | integrity sha512-wtef/y4COxM7ZVhddd7JtAAhyYObq9YXKar9tsW7558BImeVYteJiTxCKeJOL45lJ/+7B4wrAC49j8gTFYEthg== 23 | 24 | camelcase@^1.0.2: 25 | version "1.2.1" 26 | resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39" 27 | integrity sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk= 28 | 29 | center-align@^0.1.1: 30 | version "0.1.3" 31 | resolved "https://registry.yarnpkg.com/center-align/-/center-align-0.1.3.tgz#aa0d32629b6ee972200411cbd4461c907bc2b7ad" 32 | integrity sha1-qg0yYptu6XIgBBHL1EYckHvCt60= 33 | dependencies: 34 | align-text "^0.1.3" 35 | lazy-cache "^1.0.3" 36 | 37 | cliui@^2.1.0: 38 | version "2.1.0" 39 | resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1" 40 | integrity sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE= 41 | dependencies: 42 | center-align "^0.1.1" 43 | right-align "^0.1.1" 44 | wordwrap "0.0.2" 45 | 46 | decamelize@^1.0.0: 47 | version "1.2.0" 48 | resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" 49 | integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= 50 | 51 | is-buffer@^1.1.5: 52 | version "1.1.6" 53 | resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" 54 | integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== 55 | 56 | kind-of@^3.0.2: 57 | version "3.2.2" 58 | resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" 59 | integrity sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ= 60 | dependencies: 61 | is-buffer "^1.1.5" 62 | 63 | lazy-cache@^1.0.3: 64 | version "1.0.4" 65 | resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e" 66 | integrity sha1-odePw6UEdMuAhF07O24dpJpEbo4= 67 | 68 | longest@^1.0.1: 69 | version "1.0.1" 70 | resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" 71 | integrity sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc= 72 | 73 | nouislider@^13.1.5: 74 | version "13.1.5" 75 | resolved "https://registry.yarnpkg.com/nouislider/-/nouislider-13.1.5.tgz#3a0f3004159b9a77ebc07c3bedc26c97327d3522" 76 | integrity sha512-RZMuNW1Z4PcxC5q7wUKbr5EweCEnEUii3f2XtjS38VWcG5QjN11zvveRld+lrUwHIOKgfRWeIddZm5Xxfr7zCQ== 77 | 78 | repeat-string@^1.5.2: 79 | version "1.6.1" 80 | resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" 81 | integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= 82 | 83 | right-align@^0.1.1: 84 | version "0.1.3" 85 | resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef" 86 | integrity sha1-YTObci/mo1FWiSENJOFMlhSGE+8= 87 | dependencies: 88 | align-text "^0.1.1" 89 | 90 | source-map@~0.5.1: 91 | version "0.5.7" 92 | resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" 93 | integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= 94 | 95 | uglify-js@^2.4.24: 96 | version "2.8.29" 97 | resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd" 98 | integrity sha1-KcVzMUgFe7Th913zW3qcty5qWd0= 99 | dependencies: 100 | source-map "~0.5.1" 101 | yargs "~3.10.0" 102 | optionalDependencies: 103 | uglify-to-browserify "~1.0.0" 104 | 105 | uglify-to-browserify@~1.0.0: 106 | version "1.0.2" 107 | resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" 108 | integrity sha1-bgkk1r2mta/jSeOabWMoUKD4grc= 109 | 110 | window-size@0.1.0: 111 | version "0.1.0" 112 | resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d" 113 | integrity sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0= 114 | 115 | wordwrap@0.0.2: 116 | version "0.0.2" 117 | resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f" 118 | integrity sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8= 119 | 120 | yargs@~3.10.0: 121 | version "3.10.0" 122 | resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1" 123 | integrity sha1-9+572FfdfB0tOMDnTvvWgdFDH9E= 124 | dependencies: 125 | camelcase "^1.0.2" 126 | cliui "^2.1.0" 127 | decamelize "^1.0.0" 128 | window-size "0.1.0" 129 | --------------------------------------------------------------------------------