Notalib / nativescript-webview-ext

Nativescript plugin with extended WebView functionality
Apache License 2.0
76 stars 37 forks source link

webView is not loaded with the URL provided #21

Closed nbvishwa closed 5 years ago

nbvishwa commented 5 years ago

On navigating from the previous page, it is navigating to this current page but not loading the url provided.

HTML:

screen shot 2019-01-30 at 2 14 18 pm

TS: ` import { Component, OnInit, ViewChild } from "@angular/core"; import { LoadEventData, LoadFinishedEventData, ShouldOverideUrlLoadEventData, WebViewExt } from "@nota/nativescript-webview-ext";

@Component({ selector: "Webview", moduleId: module.id, templateUrl: "./webview.component.html" })

export class WebviewComponent implements OnInit { // @ViewChild('mapWebView') webViewInterface: WebViewExt; webViewInterface : WebViewExt; constructor() { console.log("constructor"); }

ngOnInit(): void {
    console.log("init");
}

public webViewLoaded(args: LoadEventData) {
    console.log("view loaded")
    if (!this.webViewInterface) {

        console.log('webview loaded');

        // this.handleLoader(true);

        this.webViewInterface = args.object;

        this.webViewInterface.src = '~/www/content/web/viewer.html' ;

        this.webViewInterface.on(WebViewExt.loadFinishedEvent, (args2: LoadFinishedEventData) => {

            console.log('webview load finished');
            // this.loadData();

        });

        // this.webViewInterface.on(WebViewExt.shouldOverrideUrlLoadingEvent,
        //     (args2: ShouldOverideUrlLoadEventData) => {

        //     console.log('webview override');
        //     args2.cancel = true;

        // });
    }
}

}

`

nbvishwa commented 5 years ago

Working as expected & hence closing this