You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
angularjs-batarang/js/directives/slider.js

44 lines
1.1 KiB
JavaScript

// range slider
panelApp.directive('batSlider', function($compile) {
return {
restrict: 'E',
terminal: true,
scope: {
minimum: '=minimum',
maximum: '=maximum'
},
link: function (scope, element, attrs) {
var dom = $('<div class="ui-slider">' +
'<a class="ui-slider-handle" href></a>' +
'<a class="ui-slider-handle" href></a>' +
'<div class="ui-slider-range"></div>' +
'</div>');
element.append(dom);
$compile(element.contents())(scope.$new());
dom.slider({
range: true,
values: [0, 100],
slide: function () {
var min = $(this).slider('values', 0);
var max = $(this).slider('values', 1);
scope.minimum = min;
scope.maximum = max;
scope.$apply();
},
stop: function () {
var min = $(this).slider('values', 0);
var max = $(this).slider('values', 1);
scope.minimum = min;
scope.maximum = max;
scope.$apply();
}
});
}
};
});