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

Commit cd0539c

Browse files
committed
Merge pull request #78 from jbarrus/destroy-fix
smarter handling of destroy - corrects for case where it fails when in a ui-modal
2 parents 1e9a4a3 + 719fdff commit cd0539c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/slider.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,13 @@ angular.module('ui.slider', []).value('uiSliderConfig',{}).directive('uiSlider',
129129
}, true);
130130

131131
function destroy() {
132-
elm.slider('destroy');
132+
if (elm.hasClass('ui-slider')) {
133+
elm.slider('destroy');
134+
}
133135
}
134-
scope.$on("$destroy", function() {
135-
destroy();
136-
});
136+
137+
scope.$on("$destroy", destroy);
138+
elm.one('$destroy', destroy);
137139
};
138140

139141
var postLink = function (scope, element, attrs, ngModel) {

0 commit comments

Comments
 (0)