Skip to content
This repository was archived by the owner on Oct 5, 2019. It is now read-only.

Commit 0772845

Browse files
committed
Merge pull request #117 from ajmirsky/master
event callbacks not triggered due to attribute naming issue
2 parents 0d327cd + 4b5c32b commit 0772845

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,9 @@ But, if the `tooltip` attribute is in conflict with another angular directive, y
3030
<!-- it can be used as an element -->
3131
<slider ng-model="sliders.sliderValue" min="testOptions.min" step="testOptions.step" max="testOptions.max" value="testOptions.value" slider-tooltip="hide"></slider>
3232
```
33+
34+
#### Event Calbacks
35+
```html
36+
<!-- event callbacks receive the name of the event and the associated value with that event -->
37+
<slider ng-model="sliders.sliderValue" onSlideStop="myCallback($event,value)"></slider>
38+
```

slider.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,11 @@ angular.module('ui.bootstrap-slider', [])
160160
slideStop: 'onStopSlide'
161161
};
162162
angular.forEach(sliderEvents, function (sliderEventAttr, sliderEvent) {
163-
var fn = $parse(attrs[sliderEventAttr]);
163+
var fn = $parse(attrs[sliderEventAttr.toLowerCase()]);
164164
slider.on(sliderEvent, function (ev) {
165165
if ($scope[sliderEventAttr]) {
166166
$scope.$apply(function () {
167-
fn($scope.$parent, { $event: ev, value: ev });
167+
fn($scope.$parent, { $event: sliderEvent, value: ev });
168168
});
169169
}
170170
});

0 commit comments

Comments
 (0)