Skip to content

Commit c86c310

Browse files
committed
wipo
1 parent 9a9db3e commit c86c310

File tree

8 files changed

+51
-10
lines changed

8 files changed

+51
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## AngularJS slider directive with no external dependencies
1+
e# AngularJS slider directive with no external dependencies
22

33
Status:
44
[![npm version](https://img.shields.io/npm/v/angularjs-slider.svg?style=flat-square)](https://www.npmjs.com/package/angularjs-slider)

demo/demo.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,17 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $modal) {
208208
}
209209
};
210210

211+
//Slider config with angular directive inside custom template
212+
$scope.slider_custom_directive_inside_template = {
213+
214+
minValue: 20,
215+
maxValue: 80,
216+
options: {
217+
floor: 0,
218+
ceil: 100
219+
}
220+
};
221+
211222
//Slider config with steps array of letters
212223
$scope.slider_alphabet = {
213224
value: 'E',
@@ -515,3 +526,17 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $modal) {
515526
}
516527
}
517528
});
529+
530+
app.directive('clickableLabel', function() {
531+
return {
532+
restrict: 'E',
533+
scope: {label: '='},
534+
replace: true,
535+
template: "<button ng-click='onclick(label)' style='cursor: pointer;'>click me - {{label}}</button>",
536+
link: function(scope, elem, attrs){
537+
scope.onclick = function(label){
538+
alert("I'm " + label);
539+
};
540+
}
541+
};
542+
});

demo/index.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,16 @@ <h2>Slider with custom display function using html formatting</h2>
157157
></rzslider>
158158
</article>
159159

160+
<article>
161+
<h2>Slider with angular directive inside custom template</h2>
162+
<rzslider
163+
rz-slider-model="slider_custom_directive_inside_template.minValue"
164+
rz-slider-high="slider_custom_directive_inside_template.maxValue"
165+
rz-slider-options="slider_custom_directive_inside_template.options"
166+
rz-slider-tpl-url="directiveInCustomTemplate.html"
167+
></rzslider>
168+
</article>
169+
160170
<article>
161171
<h2>Slider with Alphabet</h2>
162172
Current letter: {{ slider_alphabet.value }}

dist/rzslider.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*! angularjs-slider - v5.2.0 -
22
(c) Rafal Zajac <[email protected]>, Valentin Hervieu <[email protected]>, Jussi Saarivirta <[email protected]>, Angelin Sirbu <[email protected]> -
33
https://github.com/angular-slider/angularjs-slider -
4-
2016-07-07 */
4+
2016-07-09 */
55
.rzslider {
66
position: relative;
77
display: inline-block;

dist/rzslider.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*! angularjs-slider - v5.2.0 -
22
(c) Rafal Zajac <[email protected]>, Valentin Hervieu <[email protected]>, Jussi Saarivirta <[email protected]>, Angelin Sirbu <[email protected]> -
33
https://github.com/angular-slider/angularjs-slider -
4-
2016-07-07 */
4+
2016-07-09 */
55
/*jslint unparam: true */
66
/*global angular: false, console: false, define, module */
77
(function(root, factory) {
@@ -774,7 +774,8 @@
774774
useCustomTr = useCustomTr === undefined ? true : useCustomTr;
775775

776776
var valStr = '',
777-
getDimension = false;
777+
getDimension = false,
778+
noLabelInjection = label.hasClass('no-label-injection');
778779

779780
if (useCustomTr) {
780781
if (this.options.stepsArray && !this.options.bindIndexForStepsArray)
@@ -790,7 +791,9 @@
790791
label.rzsv = valStr;
791792
}
792793

793-
label.html(valStr);
794+
if(!noLabelInjection){ label.html(valStr); }
795+
796+
this.scope[which + 'Label'] = valStr;
794797

795798
// Update width only when length of the label have changed
796799
if (getDimension) {

dist/rzslider.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rzslider.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/rzslider.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,8 @@
778778
useCustomTr = useCustomTr === undefined ? true : useCustomTr;
779779

780780
var valStr = '',
781-
getDimension = false;
781+
getDimension = false,
782+
noLabelInjection = label.hasClass('no-label-injection');
782783

783784
if (useCustomTr) {
784785
if (this.options.stepsArray && !this.options.bindIndexForStepsArray)
@@ -794,7 +795,9 @@
794795
label.rzsv = valStr;
795796
}
796797

797-
label.html(valStr);
798+
if(!noLabelInjection){ label.html(valStr); };
799+
800+
this.scope[which + 'Label'] = valStr;
798801

799802
// Update width only when length of the label have changed
800803
if (getDimension) {

0 commit comments

Comments
 (0)