Skip to content

Commit 380dc0d

Browse files
committed
Merge pull request angular-ui#20 from sudhirrs/patch-1
Added destroy handler to remove the select2 when the parent element is removed from DOM
2 parents bb23603 + 2fa72ef commit 380dc0d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/select2.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ angular.module('ui.select2', []).value('uiSelect2Config', {}).directive('uiSelec
122122
}
123123
}
124124
}
125+
126+
elm.bind("$destroy", function() {
127+
elm.select2("destroy");
128+
});
125129

126130
attrs.$observe('disabled', function (value) {
127131
elm.select2('enable', !value);

0 commit comments

Comments
 (0)