如何在angular2中使用nativescript的WebView? [英] How to use nativescript's WebView in angular2?

查看:73
本文介绍了如何在angular2中使用nativescript的WebView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在页面上插入网络视图并收听"loadFinishedEvent" ... 但是为此,我需要在我的 component (ts文件)中找到webview,通过nativescript方式,我需要使用标记包装xml(UI):

I'm trying to insert a web-view on my page and listen the 'loadFinishedEvent'... But for do this, i need to find the webview in my component (ts file), through nativescript way i need to wrap my xml (UI) with a tag:

<Page xmlns="http://schemas.nativescript.org/tns.xsd

但是这样做我得到了这个错误: " TypeError:this.page.frame._getNavBarVisible不是函数",并且在没有Page标记的情况下,我已经尝试了某些方法,但是没有成功...

But doing this i got this error: "TypeError: this.page.frame._getNavBarVisible is not a function", and without the Page tag i've already tried with some ways but with unsuccessful...

我也没有找到任何样本,有人可以帮助我吗?

I do not found any sample of this too, can anyone help me?

推荐答案

包含类实现的.ts文件

Your .ts file containing class implementation

import { Component } from "@angular/core";

@Component({
selector: "Date",
templateUrl: "myPage.html", //here is your reference to html page
})

export class Angular2WebView {
//any class function
}

您的html文件myPage.html

Your html file myPage.html

<GridLayout>
    <WebView id="webView" url="http://www.google.com" >
    </WebView>
</GridLayout>

了解更多信息.请参考 Nativescript裸露的Webview似乎不起作用

for more info. refer here Nativescript bare webview doesnt seem to work

这篇关于如何在angular2中使用nativescript的WebView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆