mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2024-12-05 02:41:32 +00:00
Add url bar controller
This commit is contained in:
parent
d4081f4751
commit
6d136c9279
@ -14,9 +14,13 @@
|
||||
<app-web *ngIf="!iframeUrl"></app-web>
|
||||
<div *ngIf="iframeUrl" class="iframe-container">
|
||||
<div class="urlbar-container">
|
||||
<button class="refresh">R</button>
|
||||
<input type="text" class="urlbar" value="{{iframeUrl}}">
|
||||
<button class="go">G</button>
|
||||
<button class="refresh" (click)="reloadIframe()">R</button>
|
||||
<input type="text"
|
||||
#urlbar
|
||||
class="urlbar"
|
||||
value="{{iframeUrl}}"
|
||||
(keyup.enter)="changeIframeURL()">
|
||||
<button class="go" (click)="changeIframeURL()">G</button>
|
||||
</div>
|
||||
<iframe class="iframe"
|
||||
#webiframe
|
||||
|
@ -21,6 +21,7 @@ export class DashboardComponent implements OnInit, OnDestroy {
|
||||
deploymentNotificationSubscription: Subscription;
|
||||
@ViewChild('webiframe') webiframe: ElementRef;
|
||||
@ViewChild('tfwmessages') messages: ElementRef;
|
||||
@ViewChild('urlbar') urlbar: ElementRef;
|
||||
|
||||
layout: string = config.dashboard.currentLayout;
|
||||
hideMessages: boolean = config.dashboard.hideMessages;
|
||||
@ -144,4 +145,8 @@ export class DashboardComponent implements OnInit, OnDestroy {
|
||||
iframeLoad(): void {
|
||||
this.iframeUrl = this.webiframe.nativeElement.contentDocument.location.href.replace(document.baseURI, '/');
|
||||
}
|
||||
|
||||
changeIframeURL() {
|
||||
this.webiframe.nativeElement.contentDocument.location.href = document.baseURI + this.urlbar.nativeElement.value.substr(1);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user