Skip to content

Instantly share code, notes, and snippets.

@armorpreston
Last active February 22, 2021 22:38
Show Gist options
  • Save armorpreston/9ace9b0bee0e4c5e1bf65da48bbf93fd to your computer and use it in GitHub Desktop.
Save armorpreston/9ace9b0bee0e4c5e1bf65da48bbf93fd to your computer and use it in GitHub Desktop.
Simple Modal
<button class="btn my-4"
[modalId]="'simple-modal'"
[modalTrigger]="simpleExample"
(activated$)="activeModal = $event"
(completed$)="onComplete($event)">
<!-- [modalId], (activated$), and (completed$) are optional -->
show modal
</button>
<ng-template #simpleExample let-reject="dismiss" let-resolve=close>
<modal>
<modal-header title="Modal Title" [dismiss]="d"></modal-header>
<modal-body>
<span class="code-block--inline mb-3">modalId = `{{activeModal}}`</span>
<p>
I could / should be my own component! Reload the page to see me auto-open.
</p>
<p>
<button class="btn btn-link" (click)="reject()">Cancel</button>
<button class="btn btn-primary" (click)="resolve(101)">Proceed</button>
</p>
</modal-body>
</modal>
</ng-template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment