-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(demo): add example for
show
modal option
- Loading branch information
Showing
4 changed files
with
71 additions
and
7 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
demo/src/app/components/+modal/demos/auto-shown/auto-shown.html
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,18 @@ | ||
<button type="button" class="btn btn-primary" (click)="showModal()">Render auto-shown modal</button> | ||
<div *ngIf="isModalShown" [config]="{ show: true }" (onHidden)="onHidden()" bsModal #autoShownModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true"> | ||
<div class="modal-dialog modal-sm"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<h4 class="modal-title pull-left">Auto shown modal</h4> | ||
<button type="button" class="close pull-right" aria-label="Close" (click)="hideModal()"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
</div> | ||
<div class="modal-body"> | ||
<p>I am a modal that is shown right after initialization!</p> | ||
<p>I wasn't present in DOM until you clicked the button</p> | ||
<p>When you close me, I'll be removed from the DOM</p> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
23 changes: 23 additions & 0 deletions
23
demo/src/app/components/+modal/demos/auto-shown/auto-shown.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,23 @@ | ||
import { Component, ViewChild } from '@angular/core'; | ||
import { ModalDirective } from 'ng2-bootstrap/modal'; | ||
|
||
@Component({ | ||
selector: 'demo-modal-auto-shown', | ||
templateUrl: './auto-shown.html' | ||
}) | ||
export class DemoAutoShownModalComponent { | ||
@ViewChild('autoShownModal') public autoShownModal:ModalDirective; | ||
public isModalShown:boolean = false; | ||
|
||
public showModal():void { | ||
this.isModalShown = true; | ||
} | ||
|
||
public hideModal():void { | ||
this.autoShownModal.hide(); | ||
} | ||
|
||
public onHidden():void { | ||
this.isModalShown = false; | ||
} | ||
} |
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