从 Android WebView 调用 Angular 5 函数
Call Angular 5 function from Android WebView
我正在尝试从我的 Abdroid WebView 调用 Angular 5 函数。
在Android
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT){
this.mWebView.evaluateJavascript("fooBar();", null);
} else {
this.mWebView.loadUrl("fooBar();");
}
在我的 Angular 组件中,我添加了 fooBar 函数
在Angular组件
fooBar=function(){
console.log("fooBar");
}
但是上面的代码抛出
错误
VM772:1 Uncaught ReferenceError: fooBar is not defined at <anonymous>:1:1
任何人都可以帮助我如何从 Android Webview
调用 Typescript 函数
见
我不知道你为什么要在你的 android 网络视图中这样做。也许重新评估那个决定,虽然我不知道具体细节。
(会评论但不能)
我正在尝试从我的 Abdroid WebView 调用 Angular 5 函数。
在Android
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT){
this.mWebView.evaluateJavascript("fooBar();", null);
} else {
this.mWebView.loadUrl("fooBar();");
}
在我的 Angular 组件中,我添加了 fooBar 函数
在Angular组件
fooBar=function(){
console.log("fooBar");
}
但是上面的代码抛出
错误
VM772:1 Uncaught ReferenceError: fooBar is not defined at <anonymous>:1:1
任何人都可以帮助我如何从 Android Webview
见
我不知道你为什么要在你的 android 网络视图中这样做。也许重新评估那个决定,虽然我不知道具体细节。 (会评论但不能)