Created
October 22, 2018 17:05
-
-
Save Mattnmoore/f7c0f84853adab98e4df2b283be6ae4a to your computer and use it in GitHub Desktop.
New Content Focus
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
| <div> | |
| <button type="button" (click)="toggleForm()"> | |
| <ng-container *ngIf=" ! showForm">Show form</ng-container> | |
| <ng-container *ngIf="showForm">Back</ng-container> | |
| </button> | |
| <ng-container *ngIf=" ! showForm"> | |
| <table id="mytable"></table> | |
| </ng-container> | |
| <ng-container *ngIf="showForm"> | |
| <form> | |
| <label>Website</label> | |
| <input type="text" id="website" name="website" /> | |
| </form> | |
| </ng-container> | |
| </div> |
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
| public toggleForm() { | |
| this.showForm = ! this.showForm; | |
| let focus = this.showForm ? 'website' : 'mytable'; | |
| setTimeout(() => { | |
| document.getElementById(focus).focus(); | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment