Last active
January 27, 2020 16:00
-
-
Save armorpreston/9096ee3318db6cad4291eb6e4b9b4492 to your computer and use it in GitHub Desktop.
Brandkit/Components/aside
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
<ng-template #asideContent let-c="close" let-d="dismiss"> | |
<modal> | |
<modal-header title="Simple Aside" [dismiss]="d"></modal-header> | |
<modal-body> | |
<h4>This is an example of an aside</h4> | |
<p> | |
Lorem ipsum dolor sit amet consectetur adipiscing elit maecenas leo auctor, | |
nulla est conubia elementum netus tincidunt. | |
</p> | |
</modal-body> | |
<!-- Optional --> | |
<modal-footer> | |
<button type="button" class="btn btn-link" (click)="d('Cancel click')">Cancel</button> | |
<button type="button" class="btn btn-primary" (click)="c('Okay click')">Okay</button> | |
</modal-footer> | |
</modal> | |
</ng-template> |
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
import { Component } from '@angular/core'; | |
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; | |
import { ModalService } from '@armor/brandkit'; | |
@Component({ | |
templateUrl: './modals.html' | |
}) | |
export class ModalsComponent { | |
constructor(private ngbModal: NgbModal, private modalService: ModalService) {} | |
public closeResult: string; | |
public open(content) { | |
// For a wide aside | |
// this.modalService.openAside(content, {size: 'lg'}) | |
this.modalService.openAside(content).result | |
.then(() => { this.confirm(); }) | |
.catch(() => { this.cancel(); }); | |
} | |
public confirm() { | |
this.closeResult = `Closed/Accepted (Promise Resolved)`; | |
} | |
public cancel() { | |
this.closeResult = `Dismissed (Promise Rejected)`; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment