Last active
August 11, 2017 23:30
-
-
Save cdcarson/b715b79fc20df19436a7a10b2b9c7137 to your computer and use it in GitHub Desktop.
This file contains hidden or 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, AfterViewInit, ViewChild } from '@angular/core'; | |
@Component({ | |
selector: 'app-modal-demo-show', | |
template ` | |
<ng-template nzbModal #exampleModal="nzbModal"> | |
<div class="modal fade" tabindex="-1"> | |
<div class="modal-dialog" role="document"> | |
<div class="modal-content"> | |
<div class="modal-header"> | |
<h5 class="modal-title">Modal Shown On Route Change</h5> | |
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> | |
<span aria-hidden="true">×</span> | |
</button> | |
</div> | |
<div class="modal-body"> | |
<p> | |
<a routerLink="/modals">Back to modals</a> | |
</p> | |
</div> | |
<div class="modal-footer"> | |
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> | |
</div> | |
</div> | |
</div> | |
</div> | |
</ng-template> | |
` | |
}) | |
export class ModalDemoShowComponent implements AfterViewInit { | |
@ViewChild('exampleModal') exampleModal; | |
constructor() { } | |
ngAfterViewInit() { | |
setTimeout(() => { | |
this.exampleModal.show(); | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment