From 4b5c32bee8952ede2bbcc3e4b87de2e90f1acb3e Mon Sep 17 00:00:00 2001 From: Andrew Mirsky Date: Tue, 5 Jan 2016 18:05:02 -0500 Subject: [PATCH] angular directive's link function gets 'attrs' with normalized names (ie lowercase, without dashes) even though in the local it's case sensative. also, send the name of the event along with the event value to the callback --- README.md | 6 ++++++ slider.js | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f075dc3..aca02d2 100644 --- a/README.md +++ b/README.md @@ -30,3 +30,9 @@ But, if the `tooltip` attribute is in conflict with another angular directive, y ``` + +#### Event Calbacks +```html + + +``` diff --git a/slider.js b/slider.js index 9e59b59..57b10d6 100644 --- a/slider.js +++ b/slider.js @@ -160,11 +160,11 @@ angular.module('ui.bootstrap-slider', []) slideStop: 'onStopSlide' }; angular.forEach(sliderEvents, function (sliderEventAttr, sliderEvent) { - var fn = $parse(attrs[sliderEventAttr]); + var fn = $parse(attrs[sliderEventAttr.toLowerCase()]); slider.on(sliderEvent, function (ev) { if ($scope[sliderEventAttr]) { $scope.$apply(function () { - fn($scope.$parent, { $event: ev, value: ev }); + fn($scope.$parent, { $event: sliderEvent, value: ev }); }); } });