Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Commit

Permalink
fix(modal): check before removing element (fixes #343)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgcrea committed Jan 10, 2014
1 parent 95abe16 commit 5945bda
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/modal/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,14 @@ angular.module('mgcrea.ngStrap.modal', ['mgcrea.ngStrap.jqlite.dimensions'])
$modal.destroy = function() {

// Remove element
modalElement.remove();
backdropElement.remove();
if(modalElement) {
modalElement.remove();
modalElement = null;
}
if(backdropElement) {
backdropElement.remove();
backdropElement = null;
}

// Destroy scope
scope.$destroy();
Expand Down

0 comments on commit 5945bda

Please sign in to comment.