Modal with default options
Components as content
You can pass an existing component as content of the modal window. In this case, if you're still using Angular 8 or older, remember to add the content component in the entryComponents
section of your NgModule
. For Angular 9 or newer, it's not needed anymore.
Focus management
First focusable element within the modal window will receive focus upon opening. This could be configured to focus any other element by adding an ngbAutofocus
attribute on it.
<button type="button" ngbAutofocus class="btn btn-danger"
(click)="modal.close('Ok click')">Ok</button>
Modal with options
Stacked modals
Number of modals: 0