dougludlow / ng2-bs3-modal

Angular Bootstrap 3 Modal Component
http://dougludlow.github.io/ng2-bs3-modal/
ISC License
261 stars 133 forks source link

bug: need to ignore destruction if $model does not exist #13

Closed born2net closed 8 years ago

born2net commented 8 years ago

please fix in:

ngOnDestroy() {
        if (!this.$modal)
            return;
        this.$modal.data('bs.modal', null);
        this.$modal.remove();
    }

since in some cases, if you never actaully open a modal, yet the ModalComponent gets instantiated by the View, the $modal will not exist on the destroy, so please add if (!this.$modal) return;

tx

Sean

dougludlow commented 8 years ago

This should be fixed in v0.2.1. See https://github.com/dougludlow/ng2-bs3-modal/blob/master/src/ng2-bs3-modal/components/modal.ts#L49.

dougludlow commented 8 years ago

Thanks to @nkalinov for the pr.

born2net commented 8 years ago

Great! tx!