Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(modal): stacked modals * fix(modal): correctly trap focus for multiple modal windows Closes #2640 Closes #643
- Loading branch information
Showing
7 changed files
with
172 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<button class="btn btn-lg btn-outline-primary" (click)="open()">Launch demo modal</button> |
61 changes: 61 additions & 0 deletions
61
demo/src/app/components/modal/demos/stacked/modal-stacked.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { Component } from '@angular/core'; | ||
import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap'; | ||
|
||
@Component({ | ||
template: ` | ||
<div class="modal-header"> | ||
<h4 class="modal-title">Hi there!</h4> | ||
<button type="button" class="close" aria-label="Close" (click)="activeModal.dismiss('Cross click')"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
</div> | ||
<div class="modal-body"> | ||
<p>Hello, World!</p> | ||
<p><button class="btn btn-lg btn-outline-primary" (click)="open()">Launch demo modal</button></p> | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-outline-dark" (click)="activeModal.close('Close click')">Close</button> | ||
</div> | ||
` | ||
}) | ||
export class NgbdModal1Content { | ||
constructor(private modalService: NgbModal, public activeModal: NgbActiveModal) {} | ||
|
||
open() { | ||
this.modalService.open(NgbdModal2Content, { | ||
size: 'lg' | ||
}); | ||
} | ||
} | ||
|
||
@Component({ | ||
template: ` | ||
<div class="modal-header"> | ||
<h4 class="modal-title">Hi there!</h4> | ||
<button type="button" class="close" aria-label="Close" (click)="activeModal.dismiss('Cross click')"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
</div> | ||
<div class="modal-body"> | ||
<p>Hello, World!</p> | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-outline-dark" (click)="activeModal.close('Close click')">Close</button> | ||
</div> | ||
` | ||
}) | ||
export class NgbdModal2Content { | ||
constructor(public activeModal: NgbActiveModal) {} | ||
} | ||
|
||
@Component({ | ||
selector: 'ngbd-modal-stacked', | ||
templateUrl: './modal-stacked.html' | ||
}) | ||
export class NgbdModalStacked { | ||
constructor(private modalService: NgbModal) {} | ||
|
||
open() { | ||
this.modalService.open(NgbdModal1Content); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters