--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
No it is not that hard. See angular ui for examples!
But it is sometimes easier not to wrap!!
Pete
...from my mobile.
--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
Here's what I came up with, I'm new at this so critique away
app.directive('rangeSlider', function () {
return {
scope: {
values: '=rangeSlider',
},
link: function (scope, element, attrs) { //initialize the range slider and set some defaults -- should probably be passed in via attr/scope vars rather than set here.
element.rangeSlider({
//arrows: false,
valueLabels: "hide",
range: {min: 4, max: 4},
defaultValues:{
min: -2,
max: 2
},
bounds: {
min: -12,
max: 12
}
});
//Bind to the valueschanging event.
element.on("valuesChanging", function (e, data) {
scope.$apply(function () {
scope.values.min = data.values.min;
scope.values.max = data.values.max;
});
});
// update the range whenever the value on the scope changes
scope.$watch('min', function(value) {
element.rangeSlider("min", value);
});
scope.$watch('max', function (value) {
element.rangeSlider("max", value);
});
}
};
});