Error on close a modal with the *ngIf directive
See original GitHub issueAn error is occurring when I try to close a modal with the *ngIf directive.
Code:
<button type="button" (click)="showModal=true">
Show
</button>
<div *ngIf="showModal" [config]="{ show: true }" bsModal class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<button type="button" (click)="showModal=false">
Close
</button>
</div>
When I click on close button, the following error is displayed on the console:
ERROR TypeError: Cannot read property 'querySelectorAll' of null at ModalDirective.webpackJsonp.../../../../ngx-bootstrap/modal/modal.component.js.ModalDirective.focusOtherModal (modal.component.js:278) at modal.component.js:208 at callbackRemove (modal.component.js:237) at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:424) at Object.onInvokeTask (core.es5.js:3881) at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423) at Zone.webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask (zone.js:191) at webpackJsonp.../../../../zone.js/dist/zone.js.ZoneTask.invokeTask (zone.js:498) at ZoneTask.invoke (zone.js:487) at timer (zone.js:1829)
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (1 by maintainers)
You know the ngx-bootstrap documentation would seem to recommend what @davidmguerra (and I) are doing
Same problem on tooltips and popovers.